簡體   English   中英

找不到命令“ng”,但可以安裝

[英]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

找不到命令“ng”,但可以安裝

我搜索但我能找到任何答案。

在此處輸入圖像描述

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

可以在ng 錯誤中找到此問題

你可以試試這個建議:

嘿,您已經遇到了 angular-cli 的依賴項,但是通過終端訪問 ng 需要您在路徑環境中設置全局包的路徑。 已知路徑

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

設置一個新的怎么樣!

$ mkdir ~/path/module $ npm 配置設置前綴'~/path/module' $ sudo chown -R $USER

現在最后一步,安裝 angular/cli package npm install -g @angular/cli

8545,這里也有解決方案。 如果問題仍然存在,請關注最近的問題

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

這也讓我發瘋,我卸載了 Angular 並清理了緩存。 但沒有運氣:我最終發現了這個修復:

打開/home/user/.bashrc文件

評論或刪除這些行

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

希望這對您和其他任何人都有幫助。 祝你好運!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM