The npm community forum has been discontinued.
To discuss usage of npm, visit the GitHub Support Community.
npm-cli-login generates an error message
I am a beginner! I installed npm on Windows and followed the instructions on page https://www.npmjs.com/package/npm-cli-login to run “npm-cli-login” but it does not work. Instead, I get the following error message, which I do not understand:
throw new TypeError('Path must be a string. Received ’ + inspect(path));
TypeError: Path must be a string. Received undefined
at assertPath (path.js:28:11)
at Object.join (path.js:489:7)
at Object.processArguments (C:\Users\david\AppData\Roaming\npm\node_modules\npm-cli-login\lib\login.js:34:56)
at module.exports (C:\Users\david\AppData\Roaming\npm\node_modules\npm-cli-login\lib\index.js:4:25)
at login (C:\Users\david\AppData\Roaming\npm\node_modules\npm-cli-login\bin\npm-cli-login.js:30:19)
at Object. (C:\Users\david\AppData\Roaming\npm\node_modules\npm-cli-login\bin\npm-cli-login.js:33:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
Running in command prompt window with Admin access.
Env variables set up.
New HP laptop, Windows 10 Home, nodejs version v8.11.3, npm version 5.6.0
This has been reported as an issue here: https://github.com/postmanlabs/npm-cli-login/issues/22
If you are looking for the official way to handle authentication, check out https://docs.npmjs.com/private-modules/ci-server-config
Typcially, on a fresh machine you would start with
npm login though.
Markus, thanks for that. You say “on a fresh machine”. Are you implying that npm need only be logged into once? This confuses me, since most websites must be logged in each time you browse to them after some time has passed. Remember, I’m a beginner.
After having logged in, your credentials are stored in a
.npmrc in your home folder, which will be used for all subsequent calls by npm which require authentication.
I think that is a great design! Thanks.