I ran "np" but it failed telling me "You must be logged in. Use npm login and try again.". I executed "npm whoami" and saw that I am already logged in. So there seems to be a bug.
.np-config.json
{
"anyBranch": false,
"cleanup": true,
"contents": "proto",
"preview": true,
"tests": true,
"yarn": true
}
"Verify user is authenticated" to not fail.
np - 6.2.0
Node.js - 12.11.0
npm - 6.10.1
Git - 2.16.2.windows.1
OS - Windows 10
I added a script to my package that runs npm whoami. Running that via yarn fails as well; this does not appear to be specific to np.
...
"scripts": {
"test-who": "npm whoami"
}
mlclay@gram:~/projects/sandbox$ npm whoami
mlclay
mlclay@gram:~/projects/sandbox$ yarn test-who
yarn run v1.17.3
$ npm whoami
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
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/lucas/.npm/_logs/2020-03-11T15_03_49_396Z-debug.log
error Command failed with exit code 1.
While writing this, I came across the yarn login command. https://classic.yarnpkg.com/en/docs/cli/login/
After I ran yarn login and entered my username/email, then my subsequent yarn test-who and yarn np commands worked without the authentication issue we ran in to.
mlclay@gram:~/projects/sandbox$ yarn test-who
yarn run v1.17.3
$ npm whoami
mlclay
The @mlclay's method also helped me
@mlclay method worked for me as well
@mlclay's workaround didn't worked for me :slightly_frowning_face:
But npx np did
Most helpful comment
I added a script to my package that runs
npm whoami. Running that via yarn fails as well; this does not appear to be specific tonp.package.json:
running via npm
running via yarn
Update
While writing this, I came across the
yarn logincommand. https://classic.yarnpkg.com/en/docs/cli/login/After I ran
yarn loginand entered my username/email, then my subsequentyarn test-whoandyarn npcommands worked without the authentication issue we ran in to.