Installing Angular CLI with npm install fails

Viewed 10499

I am new to AngularJS, just started an online course.

I am trying to install angular CLI on my computer at work running Windows 7. I opened command line as administrator and running npm install -g @angular/cli. Installation starts and after a few minutes I get an error: npm install -g angular-cli error

I see the notification "operation not permitted", but I am the administrator of the computer and the command line I run as administrator.

What am I doing wrong? The same installation I did on my laptop at home and it was successful.

I am checking with our IT support about other possible causes and will appreciate any help.

This is not a duplicate of Fail to install npm package “npm ERR! errno -4048” or npm install -g angular-cli fails.

Ignoring the error and running gn -v I get the following: Ignoring the error and running ng -v

Is this correct? Was Angular CLI installed?

5 Answers

These issues are because of the company proxy settings.

Check with your admin to get the proxy for http or https.

It will be something like this:

http_proxy = http://http.myproxy.com:8000

https_proxy = http://http.myproxy.com:8000

Replace myproxy with the name of company proxy.

Then go to the command prompt and run the following command to set the proxy. Later you can run any command like npm install -g @angular/cli to run. It will work

npm config set proxy http://http.myproxy.com:8000

npm config set https-proxy http://http.myproxy.com:8000

That fsevents library has peculiarities on Windows. So I suggest you ignore the error message and run ng -v from the command prompt to confirm you got the Angular CLI libraries installed.

As the error message suggest, you don't have some permissions to execute your command.

Depending on your system, you should run the command as an administrator.

Also, don't mix AngularJS (the first Angular framework) and Angular (also known as Angular 2, 4 and 5 now) . They are radically different in their syntax and uses.

You need to run the npm commands on node.js command prompt but not on windows command line.

Workaround: install git bash on windows.

Run below command and try installing angular cli again.

npm cache clean -f

This worked for me manytimes.

Related