Angular-cli: not able to install angular js on linux lite.

Created on 15 Feb 2018  路  10Comments  路  Source: angular/angular-cli

ang

I am trying to install angular-cli on linux lite. I have installed nodejs.
root@LinuxLite-Notebook-PC:~# node -v
v9.5.0

What should I do? How to intsall angular-cli on linux lite. I ran the sudo npm install -g @angular/cli command, got errors that I have listed below.

root@LinuxLite-Notebook-PC:~# sudo npm install -g @angular/cli
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! path /usr/local/bin/ng
npm ERR! code EEXIST
npm ERR! Refusing to delete /usr/local/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /usr/local/lib/node_modules/@angular/cli
npm ERR! File exists: /usr/local/bin/ng
npm ERR! Move it away, and try again.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-02-15T10_49_29_898Z-debug.log

etmisc

All 10 comments

First I installed yarn
https://yarnpkg.com/en/docs/install

Then this worked
yarn global add @angular/cli

I was about to jump off the cliff. You just saved my life. Thanks!

ang

I have been having the same issue
The way i got to to install was by: two root shell or sudo su
one one: npm install -g @angular/cli
on the second: cd /usr/lib/node_modules/@angular/

after a bit the following message starts repeatedly appearing on the first terminal

gyp verb command install [ '8.9.4' ]
gyp verb install input version string "8.9.4"
gyp verb install installing version: 8.9.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.9.4
gyp verb ensuring nodedir is created /usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.9.4
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/8.9.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space

So on the second terminal i did chmod a+rwx cli/ -R

after this the message stopped and the install continued as it should have.

I had this same problem in the last hour, and this allowed me to install angular, so far i have seen no issues with the installation.

BTW: I did this on a fresh install of ubuntu 16.04lts from the minimalist instalation (https://help.ubuntu.com/community/Installation/MinimalCD)

I have the same problem doing the installation on my fedora 27 from a sudoer user, however i can install under root using
su npm install @angular/cli -g
but im getting this warning

````

npm install @angular/cli -g

/usr/bin/ng -> /usr/lib/node_modules/@angular/cli/bin/ng
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

  • @angular/[email protected]
    updated 1 package in 169.503s
    ````
    how can i install that peer dependency?

Not sure if I did the right thing but, since none of the suggestions worked for me, I took the

You must install peer dependencies yourself.

...literraly. So I just went:

npm i ajv@^6.0.0

And the warning is gone.

Should it be in DevDependencies or Dependencies ?
if it's related to AngularCli i would put it in DevDependencies, but am i right?

@Korigoth yes, I added it as DevDep.

Closing as the original issue appears to be solved and the peer dependency issue is being tracked here: #9691

yarn is a good solution. That worked on mac as well.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings