1

I am fairly new to Ubuntu, and decently new to AngularJS(4) and the Angular CLI as well. I have used the program with Windows 10, and now I am trying to install it on Ubuntu.

When I try and install, whether it be:

sudo npm install --unsafe-perm -g @angular/cli

(ERROR + when I try to create a new app)

    npm WARN optional Skipping failed optional dependency /@angular/cli/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.2
eddietal2@eddieslaptop:~$ ng new eddie
/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: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)

or


sudo apt install  @angular/cli

sudo: unable to resolve host eddieslaptop

(ERROR)

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package @angular

it won't install. Any help would be appreciated !

1 Answers1

0

This is because you have an old version of node. So update your node version to latest one.

Using nvm you can easily update it. Below is the command.

nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION
Eg. nvm install 7.10.0 --reinstall-packages-from=4.2.6

Then

Run command nvm use 7.10.0 to use updated version. And if you want to uninstall old version then run command nvm uninstall OLD_VERSION.

This will resolve your problem.

Surjeet Bhadauriya
  • 6,755
  • 3
  • 34
  • 52