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?
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.
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.
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
Related
I am following Cordova's Getting Started guide but I'm already stuck at the 2nd step. When I try to create my project by typing cordova create myApp, it fails with the following error message:
C:\Users\foobar\AppData\Roaming\npm\node_modules\cordova\node_modules\queue-microta
sk\index.js:5
? queueMicrotask.bind(globalThis)
^
ReferenceError: globalThis is not defined
at Object.<anonymous> (C:\Users\foobar\AppData\Roaming\npm\node_modules\cordova
\node_modules\queue-microtask\index.js:5:25)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (C:\Users\foobar\AppData\Roaming\npm\node_modules\cordova
\node_modules\run-parallel\index.js:4:24)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
I guess it's some sort of node or npm version problem. If possible though, I would rather not install a different version of node or npm, because I'm afraid it will break other projects otherwise. My node and npm versions are as follows:
node --version
v11.15.0
npm --version
6.7.0
Just make sure to reinstall the cordova if your node version changed.
And after that, cordova prepare again.
change Node version with Node Version Manager (NVM) to Node version10.X.X.
queueMicrotask don't work with Node version 11.X.X.
https://github.com/feross/queue-microtask/issues/13
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!
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!
I was working on Node version 9.1.0 but the client asked me to use NVM so that the version can be switched at will. I tried but it was not working. So I uninstalled NodeJS from my windows machine and did a fresh install of NodeJS version 8.9.4
After npm install when I tried to execute the code I got this error:
SyntaxError: Unexpected number
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\inetpub\wwwroot\NodeJS_APIs\api\node_modules\lodash\isFunction.js:1:80)
The line that trew the error is in vm.js:
function createScript(code, options) {
return new Script(code, options);//This is the line
}
I don't understand what went wrong. Can someone please explain what am I doing wrong?
From your error stacktrace it seems the error is related to your loadash library, Can you please try uninstalling it using,
npm uninstall lodash
And then reinstall a compatible lodash version like this,
npm install lodash#4.17.5
Once done, try running your script again.
Hope this helps!
You might get some hints from here, although I’m not sure: https://github.com/rollup/rollup/issues/2054
When trying to install Ember.js on Windows (and possibly other systems), after running the following commands:
npm install -g npm
npm install -g ember-cli
npm install -g bower
No errors are raised, how the command ember -v outputs the following:
C:\Users\<user>\AppData\Roaming\npm\node_modules\ember-cli\lib\cli\index.js:3
const willInterruptProcess = require('../utilities/will-interrupt-process');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\bin\ember:26:11
at C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\node_modules\resolve\lib\async.js:50:13
at processDirs (C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\node_modules\resolve\lib\async.js:182:39)
This suggests an issue with my Ember installation, how can I address this?
The solution is suggested in a few other answers, for example this one, however this exact solution will not work on Windows.
Instead, the best solution is to get the latest version of Node installed via an installer.
To verify after installation try the following:
node --version
Which should output something like:
v8.9.1
Previously this command would have given a lower version number. In my case it was similar to v0.12.
I'm trying to install the polymer CLI from here: https://www.polymer-project.org/1.0/docs/tools/polymer-cli
However, after installing it I get an error when trying to run polymer help:
[~/Documents/roottest]$ polymer help ruby:2.2.4
/opt/boxen/nodenv/versions/v0.10.26/lib/node_modules/polymer-cli/bin/polymer.js:19
let lib = path ? require(path) : require('..');
^^^
SyntaxError: Unexpected strict mode reserved word
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
[~/Documents/roottest]$ node --version ruby:2.2.4
v0.10.26
[~/Documents/roottest]$ nodenv --version ruby:2.2.4
nodenv 0.3.3
My node version is v0.10.26, my nodeenv version is 0.3.3. I'm using Mac.
Does anyone know how I would fix this?
Polymer CLI is not compatible with Node v0.10.26.
The setup guide indicates that Node 4.x or newer is required. You should actually upgrade to the latest stable version (6.2.0).