简体   繁体   English

npm install不下载最新软件包

[英]npm install NOT dowloading latest package

[context] I have a problem to use "npm install" command to update my package.json with latest dependencies. [上下文]使用“ npm install”命令更新具有最新依赖项的package.json时遇到问题。

I am running on a Jenkins slave with Multibranch Pipeline, not sure if this is the cause? 我正在使用Multibranch Pipeline在Jenkins奴隶上运行,不确定这是否是原因吗?

There is another post having a similar issue, but not been answered ... NPM package.json not updating after npm install 还有另一篇文章也有类似的问题,但没有得到回答... NPM安装后,NPM package.json没有更新

Here is my package.json 这是我的package.json

  "dependencies": {
    "@company/ai-integration-test": "^1.0.1-NIGHTLY",
    "@company/ai-portal": "^1.0.1-NIGHTLY",
    "@company/ai-portal-lambdas": "^1.0.1-NIGHTLY"
  }

Here is the result for "npm outdated" 这是“ npm过时”的结果 截图 [What do I expect] [我期待什么]
I would like to get my package.json by running some command if "npm install" is the correct command to use? 如果“ npm install”是要使用的正确命令,我想通过运行一些命令来获取我的package.json? Thanks a million !! 太感谢了 !!

delete your package-lock.json file. 删除您的package-lock.json文件。

and try npm install again. 然后尝试再次安装npm。

But npm install will only update those packages which have "^" in their version, it means auto-update that particular package when you run npm install. 但是npm install只会更新版本中带有“ ^”的软件包,这意味着在您运行npm install时会自动更新该特定软件包。

I found npm update command helps me to update package.json to the latest available version. 我发现npm update命令可以帮助我将package.json更新到最新的可用版本。 But not sure if I am doing the right things though ... inputs are still welcome !! 但是不确定我是否在做正确的事情……仍然欢迎输入! TKS !! TKS!

[Final Answer] [最终答案]

It turns out the problem was caused by our company's IT firewall settings. 原来,问题是由我们公司的IT防火墙设置引起的。 The firewall intermittently forge SSL certificate for security reasons. 出于安全原因,防火墙间歇性地伪造SSL证书。 When that happens, downloading latest package fails without giving error messages. 发生这种情况时,下载最新的软件包将失败,而不会显示错误消息。

some of those updates are the major release npm update won't update to the latest version. 其中一些更新是主要发行版, npm update不会更新到最新版本。

The major release does not update in this way because they maybe introduce breaking changes. 主要版本不会以这种方式更新,因为它们可能会引入重大更改。 npm save you from that trouble npm将您从麻烦中解救出来

npm install -g npm-check-updates

then run it: 然后运行它:

ncu -u

this will update all packages to the latest version in the package.json 这会将所有包更新为package.json中的最新版本

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

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