The definition of the one-loop supersymmetric effective action for chiral superfields coupled to a nonabelian gauge superfield is carefully discussed. The variation of the odd parity part is not always integrable after regularisation, if anomalies are present. When this is compensated by a local additional term, so as to obtain an integral variation, a supersymmetric expression for the nonabelian anomaly, satisfying the Wess-Zumino consistency conditions, is simply obtained. The nonabelian anomaly is shown to be reproduced by relating it to the index for a Dirac-like operator defined on a two-dimensional disc in the space of gauge superfields. The integrated odd parity part of the effective action is further identified formally with the spectral asymmetry of a related Dirac-like operator involving one additional boson coordinate. The results are also expressed in terms of superforms which allow a connection to be made to general topological discussions of the anomaly. This depends on an analysis of the cohomology of superforms over flat superspace.