Error in angular2 cli installation - linux

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

Related

Unable to create react project

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

vue cli version is not showing

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

Yeoman fails to run

I'm on centos 7 and I just installed nodejs version 6.14.3, npm version 3.10.10, and yo version 2.0.5. I then ran the command
yo code
In an attempt to use the yeoman generator to create a vscode extension. I then got the following error:
/usr/lib/node_modules/generator-code/generators/app/index.js:47
async prompting() {
^^^^^^^^^
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.get [as code:app] (/usr/lib/node_modules/yo/node_modules/yeoman-environment/lib/store.js:39:27)
Not sure if I'm just missing a silly dependency or something. Any ideas?
This node version, 6.X, doesn't support asyncs.
Definitely install a newer version, I recommend at least 8.X to not to risk other incompatibilities at the language level.

Firebase init throwing "Use of const in strict mode" error

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.

uncaughtException SyntaxError: Use of const in strict mode in sparkpost modules

{"level":"error","message":"uncaughtException SyntaxError: Use of
const in strict mode.\n at Module._compile (module.js:439:25)\n
at Object.Module._extensions..js (module.js:474:10)\n at
Module.load (module.js:356:32)\n at Function.Module._load
(module.js:312:12)\n at Module.require (module.js:364:17)\n at
require (module.js:380:17)\n at Object.
(/var/www/myproject/dist/node_modules/sparkpost/node_modules/request/node_modules/hawk/lib/index.js:5:33)\n
at Module._compile (module.js:456:26)\n at
Object.Module._extensions..js (module.js:474:10)\n at Module.load
(module.js:356:32)\n at Function.Module._load (module.js:312:12)\n
at Module.require (module.js:364:17)\n at require
(module.js:380:17)\n at Object.
(/var/www/myproject/dist/node_modules/sparkpost/node_modules/request/request.js:9:12)\n
at Module._compile (module.js:456:26)\n at
Object.Module._extensions..js
(module.js:474:10)","timestamp":"2017-09-25T02:45:43.418Z"}
I've found that problem when I run my node backend project. I didn't upgrade anything in these days and encounter that error accidentally.
My node version is node -v v0.10.37 npm -v 1.4.28 Please help me how to solve that issue. Thanks.

Resources