简体   繁体   中英

Command 'ng' not found, but can be installed with

I installed node v12.11.1 and npm 6.11.3 on ubuntu 19.4.but when I want to create angular project I get this error.and also installed angular cli

Command 'ng' not found, but can be installed with

I searched but i could find any answer.

在此处输入图像描述

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli

this issue can be found here in ng error

Can you try this suggestion:

Hey there,you have met the dependencies for angular-cli but accessing ng over terminal requires you to set the path for global packages in your path environment. Path known

Assuming you have a global modules set up for npm (by default ~/.node_modules_global) $ npm prefix -g Now set the path of modules/bin to our bash path environment to access over terminal

$ echo -e "export PATH=$(npm prefix -g)/bin:$PATH" >> ~/.bashrc $ source ~/.bashrc

How about setting a new one!

$ mkdir ~/path/module $ npm config set prefix '~/path/module' $ sudo chown -R $USER

Now the final touch, install angular/cli package npm install -g @angular/cli

8545, solution here too. Recent issue follow, if issue persists

From https://github.com/angular/angular-cli/issues/7735#issuecomment-345546822

This was driving me nuts too, I uninstalled Angular and cleaned the cache. but no luck: I eventually discovered this fix:

Open /home/user/.bashrc file

Comment or delete these lines :

# Load Angular CLI autocompletion. 
source <(ng completion script)

Hope this helps you and anyone else. Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM