将Angular更新到更新版本VS 2017 [英] Update Angular to newer version VS 2017
问题描述
我是node,npm和angular的新手.我从数据包发布中选了这本书,叫做《 ASP NET CORE and Angular 5》.我正在按照书中所述设置环境.
I am new to node, npm and angular. I picked up this book called 'ASP NET CORE and Angular 5' from packet publishing. I am setting up the environment as specified in the book.
我用默认模板创建了一个项目,所以它带有角4.2.5
I created a project with default template so it came with angular 4.2.5
我在package.json
中将版本号从4.2.5更改为5.0.5,并重新构建了解决方案,但是我仍然看到Dependencies/npm 4.2.5版本.该书说如果不起作用,请手动更新.在图像下方,我也执行了该步骤,仍然看到相同的结果.
I changed the version number from 4.2.5 to 5.0.5 in the package.json
and rebuilt the solution but I'm still seeing under dependencies/npm 4.2.5 version. The book said to manually update if this doesn't work. I Performed that step as well, under the image, still seeing the same result.
我正在从根文件夹中尝试使用以下命令来运行批处理文件以进行更新.我双击了它.命令提示符显示正在执行更新...
From inside the root folder, i am trying to run the batch file with the following commands to update. I double clicked on it. The command prompt was showing doing an update...
cd %~dp0
npm update
,这是更新后的dependencies/npm文件夹.仍显示4.2.5
and here is the dependencies/npm folder after the updates. Still showing 4.2.5
我已经回答了一些其他的npm更新问题,但是似乎没有任何东西可以为我更新项目.我应该如何更新此测试项目.
I have followed some other npm update questions already asked but nothing seem to be updating the project for me. How should i update this test project.
推荐答案
From this stackoverflow question, you can do this:
npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest
-g
表示全局,因此您将更新整个角度系统,并且需要管理员权限.
通常,您总是可以递归地删除node_modules
文件夹,然后运行npm install
将所有软件包都恢复为package.json
文件中指定的版本.
The -g
mean global, therefore you will be updating angular system wide and will need admin priviledges.
In a more general way, you can always delete recursively your node_modules
folder and run npm install
to get all your packages to the version specified in your package.json
file.
这篇关于将Angular更新到更新版本VS 2017的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!