How do I list Node.js version and path currently being used in npm?
I just tried npm info
which isn't a thing evidently, because I got all errors. But the first line was my OS version, second was PATH to node.exe and PATH to npm-cli.js, third was node version, fourth was npm version. Then invalid package.json, etc, etc
I'm sure there's a right way, but I think it showed me everything you are hoping to see...
Forgive me for suggesting bad answer. Maybe just check your npm-debug.log
Perhaps you can find answers to your questions there.
** EDIT
I found something in npm help
try npm config list
Christopher Sheaf
Updated on June 04, 2022Comments
-
Christopher Sheaf almost 2 years
I'm currently running into the same error as this Stackoverflow question had: SyntaxError: Use of const in strict mode?, although I'm getting it while trying to install Flux.
I've already updated my system's Node.js version with the commands shown in the linked Stackoverflow question.
npm cache clean -f sudo npm install -g n sudo n stable
When I run
node --version
I get the correct version,v8.2.1
. However, when I install modules via npm, I still get warnings such asnpm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"v0.10.25","npm":"1.3.10"})
...which suggests that npm is still using an old version of Node.
Is there a way that I can find the version of Node seen by npm, and can I determine the directory where it is installed to?
-
k0pernikus almost 7 yearsWhat does
which npm
print? -
Julien almost 7 yearscheck that
nodejs --version
also returns the correct version
-
-
Christopher Sheaf almost 7 years
npm config list
gave me thenode bin location
, and also led me tonpm config ls -l
which contained anode-version
string. As it turns out, npm is using an absolute path to /usr/bin/nodejs. The latest version of node is installed to /usr/local/bin/node with a symlink to /usr/local/bin/nodejs, but npm seems happy to ignore my $PATH variable entirely. Now I just need to find a way to point npm to the proper directory and I'm set.