更新时间:2023-09-30 10:36:04
更新08/07/2017: 如果您正在寻找如何升级cli的方法迁移到较新版本时发生重大更改,请检查此答案
npm uninstall -g angular-cli
,然后再运行npm cache clean
npm install -g angular-cli
更多详细信息此处 app
app
文件夹ng init
-此命令将通过向现有应用程序写入一些文件来初始化angular-cli
应用程序.覆盖现有文件时要小心,跳过不确定的文件,但是始终可以参考备份.ng new simple-app
-您将以此为真理应用程序的angular-cli
源. app
中的angular-cli
生成/需要的文件与simple-app
进行比较,以查看在步骤 4期间是否丢失了任何内容. angular-cli
npm模块都已安装到您的app
中(比较package.json
文件)npm start
,它可能会给您一个必须修复的错误.您可能需要在此处返回步骤 7.和 8..如果您弄乱了软件包,则可能需要删除node_modules
文件夹并运行npm install
.app
npm uninstall -g angular-cli
thennpm cache clean
npm install -g angular-cli
more details here app
app
folderng init
- this command will initialize the angular-cli
app by writing some files in to your existing app. Be careful with overriding the existing files, skip the ones you are not sure, however you always can refer to your backup.ng new simple-app
- this one you will be using as a angular-cli
source of truth app. angular-cli
in your app
with simple-app
to see if anything gets missed during step 4.
angular-cli
npm modules gets installed in to your app
(compare package.json
files)npm start
it might give you an errors you have to fix. You might need to go back to steps 7. and 8. here. If you mess up the packages you might need to remove node_modules
folder and run npm install
.app
at http://localhost:4200