简体   繁体   English

奇怪的NPM更新行为

[英]Strange npm update behavior

I shall mention that, I am a newbie to Angular and NPM. 我要提到的是,我是Angular和NPM的新手。

I have two projects, both are created using Angular-CLI. 我有两个项目,都是使用Angular-CLI创建的。 In one of them when I execute npm update --save the dependencies get updated (including @angular dependencies from ^5.2.0 to ^5.2.3 ) in package.json file, but in the other one nothing gets updated. 在其中之一中,当我执行npm update --savepackage.json文件中的依赖项保存更新(包括从^5.2.0^5.2.3 @angular依赖项),而在另一项中则什么都没有更新。

I shall mention that both projects reside in a single computer, and even the project whose package.json is not updated runs using Angular 5.2.3 (the files in /node_modules/@angular/... are from 5.2.3 version of Angular). 我将提到两个项目都驻留在一台计算机上,甚至未更新package.json的项目也使用Angular 5.2.3运行( /node_modules/@angular/...中的文件来自Angular的5.2.3版本)。

I even have tested ncu , but got same results. 我什至已经测试过ncu ,但是得到了相同的结果。

I can not understand why one project dependencies gets updated, but other ones does not. 我不明白为什么一个项目依赖项被更新,而另一些则没有。

You are only updating the package.json of the actual project. 您只更新实际项目的package.json

/node_modules/@angular/... are dependencies. /node_modules/@angular/...是依赖项。 The version there is from the included model. 那里的版本来自随附的模型。

The model have to update his dependencies if in the /node_modules/@angular/.../package.json should be an other version. 如果/node_modules/@angular/.../package.json中的/node_modules/@angular/.../package.json应为其他版本,则该模型必须更新其依赖项。

For Example: this is the package.json from angular: https://github.com/angular/angular/blob/master/package.json 例如:这是来自angular的package.jsonhttps : //github.com/angular/angular/blob/master/package.json

they have to update there own project and after you have to update your project with npm update --save , if the package.json in the angular model should change. 他们必须更新自己的项目,如果角度模型中的package.json应该更改,则必须使用npm update --save更新项目之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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