I need node10+ version for Angular 8 CLI and while using node10.16.2, I get the error shown below, and see the same error while running npm build
npm-v10.16.2 -v
/auto/sw/packages/node/v10.16.2/lib/node_modules/npm/bin/npm-cli.js:84
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
How to resolve this issue?
You need to update your node package to solve this issue.
If you're on ubuntu, try running
sudo npm install -g n
sudo n stable
This will install the latest node package.
Related
System throws unexpected token error when npx creat-react-app is executed.
Node version:16.15.0
C:\Users\HammadAli\Desktop\Course Work>npx create-react-app app
C:\Users\HammadAli\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\index.js:54
const { init } = require('./createReactApp');
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
Try to downgrade npm version. I had this same, on 16.14.0. I recommend nvm for changing node version. For example: nvm install 14.18.1 nvm use 14.18.1
Installed Node version 12.13.0 on windows 10. All npm commands throws the following error:
C:\Users\Jahangeer> npm -v
evalmachine.<anonymous>:27
const { Math, Object } = primordials;
^
ReferenceError: primordials is not defined
at evalmachine.<anonymous>:27:26
at Object.<anonymous>
(C:\Users\Jahangeer\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:1)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous>
(C:\Users\Jahangeer\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-
fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:956:30)
Tried uninstalling and installing few other older Node versions. The Problem remains.
Use these commands to install node 11 and gulp 3 and check:
npm install -g n
sudo n 11.15.0
npm install gulp#^3.9.1
npm install
npm rebuild node-sass
Trying to install Elm on Windows Ubuntu, but getting the the error below
Tried running npm install -g elm got permission errors, even after using administrator
XXXX:~$ npm install -g elm
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
XXXX:~$ elm -v
/mnt/c/Users/Lenovo/AppData/Roaming/npm/node_modules/elm/bin/elm:1
ELF
^
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Expecting Elm to install, I believe it should have installed together with Node
Using brew on Mac to install Node and NPM. Running npm gives error
/usr/local/lib/node_modules/npm/bin/npm-cli.js:85
let notifier = require('update-notifier')({pkg})
^^^^^^^^
SyntaxError: Unexpected identifier
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 Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
I found some similar questions, but either not exactly like it, or with no solution. So nothing seems to work for me. Any idea?
Had the same issue changed the node js version https://nodejs.org/en/download/releases/ removed npm folder from appdata and installed
I used npm install npm#latest -g, to update the new version of npm.
but I am not able run npm. I don't know how to fix this. I have used some of the online guideline, but It didn't worked for me.
getting error on npm
.nvm/versions/node/v4.1.2/lib/node_modules/npm/bin/npm-cli.js:79
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:413:25)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:118:18)
at node.js:952:3
You are using nodeV4.1.2, it don't suppport it.
You can add 'use strict'; in line 1 or update node.