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.
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
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.
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 installed firebase tools using
sudo npm install -g firebase-tools
and everything seemed to install fine. I already had npm and node.js installed and these are the versions:
npm: 2.11.3
node: v0.12.7
But when I try running
firebase init
from my project file, I get this error
/usr/local/lib/node_modules/firebase-tools/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
const Hoek = require('hoek');
^^^^^
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 Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/node_modules/hawk/lib/index.js:5:33)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
How can I fix this error?
This error is due to Node.js version, you need to update to version 8 or higher.
I am installing angular2 in linux with
sudo npm install -g #angular/cli
and after running that it successifully installs but after typing
ng new mynewapp
Am getting an error
/usr/local/lib/node_modules/#angular/cli/models/config/config.js:16
constructor(_configPath, schema, configJson, fallbacks = []) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/#angular/cli/models/config.js:3:18)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
what could be wrong
It's seem your nodejs version does not support ES2015, update your node to version 6+
you can using nvm to manage your node version
Your need Node version 6.x or higher
See documentation below
take a look here: https://github.com/angular/angular-cli/issues/4604