0
votes

I have an Ubuntu instance on AWS, I'm using forge to setup the server. I have installed the packages nodejs and npm. To solve the problem of installing global packages on Ubuntu I have followed the second solution mentioned in this tutorial, https://docs.npmjs.com/getting-started/fixing-npm-permissions

Now when I try to install using this command,

npm install -g @angular/cli

I get the following error,

forge@frontend-staging:~/frontend/current$ npm install -g @angular/cli

▐ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ WARN engine @angular/[email protected]: wanted: {"node":">= 6.9.0","npm":">= 3.0.0"} (current: {"node":"4.2.6","npm":"3.5.2"}) loadDep:node-sass → heade ▌ ╢███████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:node-sass → resol ▄ ╢███████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:node-sass → mapTo ▀ ╢███████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:node-sass → after ▐ ╢███████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:@ngtools/json-sch ▄ ╢████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:yargs → 200 ▌ ╢█████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ /home/forge/.npm-global/bin/ng -> /home/forge/.npm-global/lib/node_modules/@angular/cli/bin/ng

[email protected] install /home/forge/.npm-global/lib/node_modules/@angular/cli/node_modules/node-sass node scripts/install.js

sh: 1: node: not found npm WARN install:[email protected] [email protected] install: node scripts/install.js npm WARN install:[email protected] spawn ENOENT /home/forge/.npm-global/lib └─┬ @angular/[email protected] └── UNMET OPTIONAL DEPENDENCY node-sass@^4.3.0

npm WARN optional Skipping failed optional dependency /@angular/cli/chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: [email protected]

4
Clear all the relevant node_modules, cache, appdata and then reinstall nodejs. Login as a sudo user. use the command sudo npm install ... - Aravind

4 Answers

0
votes

Run Following commands,

sudo apt-get uninstall nodejs

sudo apt-get install python-software-properties
$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -

sudo apt-get install nodejs

Now, check your node/npm version using

node -v 
npm -v 

Then try to install CLI.

0
votes

We can use yarn package manager. Its fast, easy, understandable (meaningful). You can :

  1. Install yarn

    npm install yarn -g

  2. use yarn to install angular-cli

yarn global add angular-cli

Done thats its it worked for me.

0
votes

I had a similar issue to this, the problem was caused by my version of node installer 4.7.2 and not newer 6.x version as per this question. So I installed angular-cli instead as this answer suggested.

If you have installed @angular/cli, you need NodeJS higher 6.9.7, together with NPM 3 or higher.

If you have installed angular-cli, you need NodeJS higher than 4.4.x, together with NPM 3 or higher.

For more see the links above and read the prerequisites.

0
votes

You are getting this error because your configuration is "current: {"node":"4.2.6","npm":"3.5.2"}". As per the documentation, You need to have Node 6.9.0 or higher and NPM 3 or higher. For more information, Please visit Official Site: https://www.npmjs.com/package/@angular/cli.

What you need to do is, Update your node version. All d best!!!