Reputation:
The program 'ng' is currently not installed. You can install it by typing: sudo apt install ng-common
I got no erros during installation, how can i fix this?
Edit: this happens when i try to run ng new PROJECT_NAME
Upvotes: 26
Views: 36534
Reputation: 1904
If you installed Angular CLI using YARN, you must do it globally. Otherwise you get this error. So the fix is:
sudo yarn global add @angular/cli
Then check your Angular version by
ng --version
Linux PopOS (Debian/Ubuntu)
Upvotes: 0
Reputation: 1
Use this command. It will work perfectly.
sudo npm install --unsafe-perm -g @angular/cli
Upvotes: 0
Reputation: 1
You have the wrong package:
Just
sudo apt remove ng-common
and
npm install -g @angular-cli
Restart your PC or Terminal
Upvotes: -2
Reputation: 1677
By running this command:
npm bin -g
you can see where the npm installs packages globally, including the angular/cli
. When you run this command you'll probably see something like this in the output:
/some/directory/bin
(not in PATH env variable)
If so, as you can see in the parentheses, it's saying that this directory is not in PATH env! So what you need to do is to either change this directory to another directory (which is in the PATH env, e.g usr/bin) by npm config set prefix
command:
npm config set prefix '/usr'
or to add this directory to the PATH env, by any way you know! But to do so for example you can add this line of code to the ~/.profile
file:
export PATH=/some/directory/bin:$PATH
and then restart your computer.
Upvotes: 2
Reputation: 1140
This command worked fine for my issue. press ctrl+T. Then run the following command.
Before that make sure you have installed node js in your local machine. for the verification, you have already installed node js, run the following command on your terminal.
node --version
Then install ng packages by running following commands on your terminal.
npm install -g @angular/cli@latest
npm link @angular/cli
Then it will work fine. for the verification of work, fine run any ng command. for example, run on the terminal following command.
ng --version
Upvotes: 4
Reputation: 1585
If nothing works, try out this simple step mentioned at https://github.com/angular/angular-cli/issues/10728 bu 'Jikaworld'. Then try the remianing commands for installing angular. It should work.
sudo npm install -g @angular/cli --unsafe-perm=true --allow-root
Upvotes: 0
Reputation: 22553
That's not how you install the angular command-line tools. You need to use npm to install them globally:
npm install -g @angular/cli
If you want to install a particular version then use
npm install -g @angular/cli@x
(where x
is version number for example. npm install -g @angular/cli@7
)
Upvotes: 7
Reputation: 932
first in whichever directory you are in come back to home directory
ie prashanth:~/Projects/angular2$ cd ----> prashanth:~$
then enter the following commands
npm bin -g
outputs---> /usr/bin
next,
sudo npm rm -g @angular/cli
clear npm cache,
npm cache clear
then install angular-cli globally,
sudo npm install -g @angular/cli
now you r good to go, type
ng -v
and check the version installed.
Upvotes: 19
Reputation: 61
To install it globally, Just run
npm install -g @angular/cli
After that run this command
npm link @angular/cli
and it should work seamlessly and If still not works
restart your system
Upvotes: 6
Reputation: 468
It works for me
The problem like Refuse to delete old ng file means rename the ng file using mv target file new_file_name
and installlsudo npm install --unsafe-perm -g @angular/cli
.
Upvotes: 0
Reputation: 387
The issue is not specific to Ubuntu version.
Edit (26 Aug, 2018):
Run npm list -g --depth=0
and see if @angular/[email protected]
is present in the results.
If it isn't, then you've probably installed angular in local scope.
Install it in global scope with Robert's method mentioned here.
If it still doesn't fix the issue, then reinstall angular completely:
npm uninstall -g @angular/cli
npm cache clear --force
npm install -g @angular/cli
@angular/cli
with angular-cli
if you've installed an older version of angular.If you have installed node
by any other method, follow Edgar's method above.
Upvotes: 11
Reputation: 337
Below steps solved my issue,
Upgrade npm to latest
npm install -g npm@latest
2 Remove angular-cli if already exists
npm remove -g angular-cli
Clear cache
npm cache clean
For latest version of npm you don't have to do this. It will correct itself. You can verify using ,
npm cache verify
4 Install angular/cli again
npm install -g angular-cli
Upvotes: 0
Reputation: 340
There is no error in node_modules permission
Actually angular 2 is updated to @angular/cli from angular/cli
If you mistakenly install angular 2 using
npm install -g angular-cli
then run
npm install -g @angular-cli
and then
npm install -g @angular-cli/latest
Thanks
Upvotes: 0
Reputation: 2880
I had the same problem because I downloaded and installed nodejs from the tar.gz package. I did the following to solve the problem:
sudo apt install npm
. then upgrae using npm install -g npm@latest
nvm install --lts
npm install -g @angular/cli
.This should fix the problem. If you are still unable to use ng, then check your environmental variables to make sure it has been correctly set.
Upvotes: 2
Reputation: 20533
The official Angular-cli documentation say that the installation command is:
$ npm install -g @angular/cli
Again, in the official github repo, installation section is the same command
I had the same problem on ubuntu 16, and after run with sudo, the npm install in that way, everithing goes ok
Upvotes: 0
Reputation: 4343
As said here by manuelfink it is a memory issue. Installation needs at least 1GB ram.
Do not forget to run npm cache clean
between every attempt.
Upvotes: 0
Reputation: 368
It looks like you have the ng-common package installed on your system, which also provides the ng executable:
http://packages.ubuntu.com/xenial/all/ng-common/filelist
If you are not using ng-common then remove it using sudo apt remove ng-common
then remove node cache
and give a path to in .bashrc or .profile
alias='path/to/node_modules/angular-cli/bin/ng'
Upvotes: -1