How to fix Nodemon "async remove {}" syntax error?
Asked Answered
C

3

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?

Crt answered 16/12, 2019 at 19:34 Comment(3)
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.0Vanlandingham
Right, Node 6.5.0 is over 3 years old, which is positively antique in the Node world.Scabby
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.Crt
H
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.

Handcart answered 16/12, 2019 at 19:48 Comment(0)
I
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.

Immingle answered 9/3, 2020 at 19:9 Comment(0)
B
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
Bifarious answered 17/9, 2020 at 21:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.