I am trying to install the Angular CLI on Ubnutu 17.04 with via
sudo npm install -g @angular/cli
However it generates the following warnings:
npm WARN gentlyRm not removing /usr/local/bin/ng as it wasn't installed by /usr/local/lib/node_modules/@angular/cli
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
and once completed, although the ng
executable is in my path, if I try to run any command (e.g. npm serve
) I am given the following:
/usr/local/lib/node_modules/@angular/cli/models/config/config.js:17
constructor(_configPath, schema, configJson, fallbacks = []) {
^
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 Module.require (module.js:353: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:409:26)
at Object.Module._extensions..js (module.js:416:10)
It appears to have (attempted?) to install Angular CLI 1.3.2 but the command ng --version
doesn't even run. (Produces the error above). As a result I cannot run npm start for Angular 2 apps that I am building.
My npm version is 5.3.0, nodejs version is v4.7.2. I have tried many times now to get this to work and I'm starting to think that maybe there's a bug in npm or angular CLI because I've been successful at installing the Angular CLI on both Mac, Windows and ArchLinux on the command line. How can I get npm to run angular apps on Ubuntu?