Ubuntu 16 does not recognize ng commands

The 'ng' program is not currently installed. You can install its input: sudo apt install ng-common

I did not have erros during installation, how can I fix this?

Edit: this happens when I try to run ng new PROJECT_NAME

+9
source share
12 answers

first in any directory you will return to your home directory

those. prashanth: ~ / Projects / angular2 $ cd → prashanth: ~ $

then enter the following commands

Npm bin -g
outputs ---> / usr / bin

following,

sudo npm rm -g @ angular / cli

clear npm cache

flushing npm cache

then install Angular-Cli everywhere,

sudo npm install -g @ angular / cli

Now you are ready to go, enter

ng -v

and check the installed version.

+6
source

This issue does not apply to the Ubuntu version.

Edit (August 26, 2018):

Run npm list -g --depth=0 and see if @angular/ cli@xxx present in the results.

If this is not the case, then you probably set the corner in the local scope.

Install it globally using the Robert method mentioned here .


If the problem still persists, reinstall angular completely:

  • npm uninstall -g @angular/cli
  • npm cache clear --force
  • npm install -g @angular/cli

  • Replace @angular/cli with angular-cli if you installed an older version of angular.

If you installed node any other way, follow Edgar's method above .

+5
source

To install it globally, just run

npm install -g @ angular / cli

After that run this command

npm link @ angular / cli

and this should work without problems and if still not working

reboot your system


+3
source

This is not how you install the angular command line tools. You need to use npm to install them worldwide:

 npm install -g angular-cli 
+1
source

I had the same problem because I downloaded and installed nodejs from the tar.gz package. To solve the problem, I did the following:

  • The nodejs folder has been deleted (mine was on Downloads)
  • Deleted npm and node from my path, removing from ~ / .profile
  • Install nvm as described here
  • Install npm with sudo apt install npm . then upgrade using npm install -g npm@latest
  • Updating node with nvm install --lts
  • Run npm install -g @angular/cli .

This should fix the problem. If you still cannot use ng, check your environmental variables to make sure it is set correctly.

+1
source

As stated here and here , it could be a memory issue. After increasing the RAM from 1024 to 2048, the error disappeared.

0
source

As said here manuelfink is a memory issue. Installation requires at least 1 GB of RAM.

Remember to run npm cache clean between each attempt.

0
source

The official Angular-cli documentation says the install command:

 $ npm install -g @angular/cli 

Again, in the official github repo, the installation section is the same command

I had the same problem on ubuntu 16 , and after starting with sudo , the npm installation is installed this way, ever ok

0
source

No error in node_modules resolution

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

  1. npm install -g @angular -cli / latest

thanks

0
source

The steps below solved my problem,

  1. Update npm to the latest version

    npm install -g npm @latest

2 Remove angular-cli if it already exists

npm remove -g angular-cli

  1. Clear cache

    flushing npm cache

    For the latest version of npm you do not need to do this. It will correct itself. You can check using

    npm cache check

4 Install Angular / Cli again

npm install -g angular-cli

0
source

This works for me. The problem, like Failing to delete the old ng file, means renaming the ng file using mv target file new_file_name and installing sudo npm install --unsafe-perm -g @angular/cli .

click here to source

0
source

It looks like the ng-common package is 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, remove it with sudo apt remove ng-common

then remove node cache

and specify the path in .bashrc or .profile

alias = 'path / to / node_modules / angular-cli / bin / ng'

-one
source

All Articles