Publishing to NPM with 2FA on CircleCI 2.0



I went to bump a version on my package and with the latest npm update they enabled the 2FA stuff. I set it up and initialized a new token under NPM_TOKEN. Ran a rebuild and receive the following:

npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2017-12-12T20_26_30_780Z-debug.log
The script called "release" which runs "semantic-release pre && npm publish && semantic-release post" failed with exit code 1
error Command failed with exit code 1.

I found that in the 1.0 docs I should do the following

I’ve setup my config.yml as what is seen in the following gist, but I am still getting this error. I downloaded the artifacts from the checkout_code job and there is no .npmrc being shown so I’m assuming it’s not being created. I don’t know if I am not persisting correctly or if I should be calling this differently. I can’t find anything in the 2.0 docs on it. Thank you for your help!



I think the issue is that persist workspace in your example will save the project root, but the file is created in the $HOME directory. So, you would need to either run this step multiple times or save the entire home directory to the workspace as well.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.