2

I've been using npm for a while now but now every time I try to run any npm command I get the following error. I have no idea how to fix this.

USER-mbp:/ USER$ npm -v
/Users/USER/.nvm/versions/node/v5.12.0/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: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

Any help would be appreciated!

If there is any information missing, I'll update as soon as I can!

Barcoma
  • 89
  • 7

1 Answers1

2

You might need to update your node version.

here is a question explaining how: How do I update Node.js?


They will recommend you to install Node Version Manager (NVM)

once you have that installed you want to run:

nvm install node //"node" is an alias for the latest version

Good luck!

Brainmaniac
  • 2,203
  • 4
  • 29
  • 53