10

Whenever I try to run nodemon to auto-restart my local server (running on port 3000), I get this error message regarding a syntax error in the no

/Users/SI23/.nvm/versions/node/v6.5.0/lib/node_modules/nodemon/node_modules/chokidar/index.js:151
  async remove(item) {
        ^^^^^^
SyntaxError: Unexpected identifier
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/SI23/.nvm/versions/node/v6.5.0/lib/node_modules/nodemon/lib/monitor/watch.js:6:16)
    at Module._compile (module.js:556:32)

Any way to fix this?

3
  • 5
    the problem is literally the node version you are using. update your node to a newer version(highly recomment 10.15.3 so you can use the harmony flag, or downgrade chokidar to a version which is compatible with node v6.5.0
    – r3wt
    Dec 16, 2019 at 19:36
  • Right, Node 6.5.0 is over 3 years old, which is positively antique in the Node world.
    – Pointy
    Dec 16, 2019 at 19:40
  • Ok, thanks. I have already installed the newest version of Node.js from the website using the installer, but for some reason when I check the version in terminal through node -v, it still shows 6.5.0.
    – SI23
    Dec 16, 2019 at 20:32

3 Answers 3

5

As per my knowledge

Async Await is not available in node v6.5.0,

which you are using. So you can upgrade your node version or can start using Promise object with the same version of node.

2

In my case, npm list chokidar helped me realize it was another module (gulp-nodemon) that used a newer version of chokidar. It worked after downgrading it.

0

I had exactly the same error...! it was a node version problem, I was on node version 6, this is what I did to fix it:

  • nvm install <VERSION_NUMBER> // nvm install 10.15.3
  • nvm use <VERSION_NUMBER> // nvm use 10.15.3
  • node -v // confirm i am using the correct version of node

Remember to do this on your computer not just your code file and change the default node version with nvm alias default 10.15.3

you can check your default lists with

  • nvm list

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.