0

I am using Ubuntu 16.04.

After installing npm, it's not working as intended. I am getting error like the following:

$ npm -v /home/MYUSERNAME/.npm-packages/lib/node_modules/npm/bin/npm-cli.js:85 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:374:25) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10) at startup (node.js:136:18) at node.js:966:3

Here are the sources I tried to install/reinstall npm from:

  1. nodesource
  2. digitalocean
  3. rosehosting

I know in Ubuntu 16.04, I need to alias /usr/bin/nodejs as /usr/bin/node to make npm work. After doing so, I can check the node version as the following picture shows.

$ node --version v4.2.6

But I still cannot use npm. I have searched and found some similar github issue link, that seems to have been resolved, but couldn't understand how they solve it.

How can I solve this problem? Thank you for your time.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.