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
Related
Everytime i open terminal in mac, i get the below error,
/usr/local/lib/node_modules/npm/lib/cli.js:2
module.exports = async (process) => {
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:2:1)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `npm config delete prefix` or `nvm use --delete-prefix v6.10.3 --silent` to unset it.
How can i fix it? I am using node version v16.13.2 and npm 8.1.2 in macOs Monterey.
Am trying to run vue.js app for that I have installed vue cli by folliwng the official website("https://cli.vuejs.org/guide/installation.html"). When i execute any vue commands getting below error, I even cant able to check it's version. Is there anything i missied here?
Step1:- npm install -g #vue/cli
Sep2:- vue --version
The npm version is "6.2.0" and nodejs version is "v6.14.3".
andy#ip-172-16-198-195:~/vue/progressive-weather-app$ vue --version
/usr/lib/node_modules/#vue/cli/node_modules/open/index.js:16
const wslToWindowsPath = async path => {
^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/#vue/cli/node_modules/#vue/cli-shared-utils/lib/openBrowser.js:9:14)
Vue CLI requires Node.js version 8.9 or above (8.11.0+ recommended).
You should update your nodejs version
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