nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.48k stars 284 forks source link

can't install packages because node version is detecting as 0.12.2 instead of 12.2 #2599

Closed sfilippov closed 1 year ago

sfilippov commented 4 years ago

I downloaded latest LTS version from https://nodejs.org/en/download/ as a msi package After installing node I tried npm install but packages show me WARN messages:

npm WARN package.json path@0.12.7 path is also the name of a node core module. npm WARN engine sass-loader@8.0.2: wanted: {"node":">= 8.9.0"} (current: {"node":"0.12.2","npm":"2.7.4"}) npm WARN peerDependencies The peer dependency fibers@>= 3.1.0 included from sass-loader will no npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly. npm WARN engine loader-utils@1.4.0: wanted: {"node":">=4.0.0"} (current: {"node":"0.12.2","npm":"2.7.4"}) npm WARN engine schema-utils@2.6.5: wanted: {"node":">= 8.9.0"} (current: {"node":"0.12.2","npm":"2.7.4"}) npm WARN engine clone-deep@4.0.1: wanted: {"node":">=6"} (current: {"node":"0.12.2","npm":"2.7.4"}) npm WARN engine emojis-list@3.0.0: wanted: {"node":">= 4"} (current: {"node":"0.12.2","npm":"2.7.4"}) npm WARN engine shallow-clone@3.0.1: wanted: {"node":">=8"} (current: {"node":"0.12.2","npm":"2.7.4"}) npm WARN engine punycode@2.1.1: wanted: {"node":">=6"} (current: {"node":"0.12.2","npm":"2.7.4"}) npm WARN engine fibers@4.0.2: wanted: {"node":">=10.0.0"} (current: {"node":"0.12.2","npm":"2.7.4"})

node -v command shows me: v0.12.2

installing failed and shew me errors: ` const { warn } = require('./logging'); ^^^^^ SyntaxError: Use of const in strict mode. at exports.runInThisContext (vm.js:73:16) at Module._compile (module.js:443:25) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (C:\Users\SFilippov\AppData\Roaming\npm\node_modules\windows-build-tools\dist\index.js:6:1) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "--global" "--production" "windows-build-tools" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! code ELIFECYCLE

npm ERR! windows-build-tools@5.2.2 postinstall: node ./dist/index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the windows-build-tools@5.2.2 postinstall script 'node ./dist/index.js'. npm ERR! This is most likely a problem with the windows-build-tools package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node ./dist/index.js npm ERR! You can get their info via: npm ERR! npm owner ls windows-build-tools npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! C:\WINDOWS\system32\npm-debug.log`

I guess version must be 12.16.2 or smth like this instead of 0.12.2

devsnek commented 4 years ago
const { warn } = require('./logging');
^^^^^
SyntaxError: Use of const in strict mode.

You legitimately have version 0.12.2. Node v12 would not give this error.

sfilippov commented 4 years ago

Found a reason. There are two versions of NPM on my machine, but Environment Path had a reference to old npm in a C:\Program Files (x86)\nodjs path instead of C:\Program Files\nodjs

github-actions[bot] commented 1 year ago

There has been no activity on this issue for 3 years and it may no longer be relevant. It will be closed 1 month after the last non-automated comment.

github-actions[bot] commented 1 year ago

There has been no activity on this issue and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.