Search code examples
javascriptnode.jsnodemon

Syntax error when querying for nodemon version after installation


i am trying to work with nodemon, but it's not working after the install. pls help

nodemon Installation snippet:

abhishek@Abhisheks-MacBook-Air ~ % sudo npm i -g nodemon
Password:
/Users/abhishek/.nvm/versions/node/v8.2.1/bin/nodemon -> /Users/abhishek/.nvm/versions/node/v8.2.1/lib/node_modules/nodemon/bin/nodemon.js
+ nodemon@2.0.20
updated 1 package in 1.996s

Error when tried checking nodemon version:

abhishek@Abhisheks-MacBook-Air ~ % nodemon -v
/Users/abhishek/.nvm/versions/node/v8.2.1/lib/node_modules/nodemon/node_modules/chokidar/index.js:941
  const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts};
                                                                ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/abhishek/.nvm/versions/node/v8.2.1/lib/node_modules/nodemon/lib/monitor/watch.js:6:16)

node and npm versions:

abhishek@Abhisheks-MacBook-Air ~ % node -v
v8.2.1
abhishek@Abhisheks-MacBook-Air ~ % npm -v
5.3.0

Solution

  • As commented by @Barmar, Upgarde Node.js version I upgraded it to 8.11.2. So, it does not break existing feature and it's working.