简体   繁体   中英

Hitting npm error while running npm -version

I need node10+ version for Angular 8 CLI and while using node10.16.2, I get the error shown below, and see the same error while running npm build

npm-v10.16.2 -v
/auto/sw/packages/node/v10.16.2/lib/node_modules/npm/bin/npm-cli.js:84
let notifier = require('update-notifier')({pkg})
      ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:148:18)
at node.js:405:3

How to resolve this issue?

You need to update your node package to solve this issue.

If you're on ubuntu, try running

sudo npm install -g n
sudo n stable

This will install the latest node package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM