重新安装angular-cli后,您必须位于angular-cli项目中才能使用build命令 [英] You have to be inside an angular-cli project in order to use the build command after reinstall of angular-cli
问题描述
我在全球范围内安装了最新的angular-cli,并且我的项目正在成功构建.
I had the latest angular-cli installed globally and my project was building successfully.
在阅读针对其他问题的建议解决方案时,( https://github.com/angular/angular-cli/issues/917 ),我卸载了全局angular-cli并将其安装为dev-dependency.
While reading a suggested solution for another issue, (https://github.com/angular/angular-cli/issues/917) I uninstalled the global angular-cli and installed it as a dev-dependency.
另一个问题没有解决,所以我卸载了dev-dependency,然后再次在全局重新安装了angular-cli. 现在,当我尝试进行 ng构建时,出现了错误:
That other issue wasn't solved so I uninstalled the dev-dependency and reinstalled angular-cli globally once again. Now when I try to do an ng build I'm getting the error:
您必须在angular-cli项目中才能使用构建命令
我的angular-cli版本没有更改.为什么我的项目没有被视为angular-cli项目?
My angular-cli version did not change. Why isn't my project being recognised as an angular-cli project??
推荐答案
好,找到了.
package.json 必须包含对 angular-cli 的依赖.
当我卸载本地的angular-cli时,npm也删除了依赖项.
When I uninstalled my local angular-cli, npm also removed the dependency entry.
这篇关于重新安装angular-cli后,您必须位于angular-cli项目中才能使用build命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!