简体   繁体   English

npm install不在乎package-lock.json

[英]npm install does not care package-lock.json

My npm install on jenkins installs a version of a package other than defined in the package-lock.json. 我在jenkins上的npm install安装了package-lock.json中未定义的软件包版本。

When I run it locally (on a windows), it works as expected, 1.4.10 of cleave.js package is installed. 当我在Windows上本地运行时,它按预期工作,安装了1.4.10的cleave.js软件包。 Though, when I run it through jenkins, it installs a different version, 1.5.3. 但是,当我通过jenkins运行它时,它会安装另一个版本1.5.3。

When I checked the jenkins build logs, it looks like it installs the package from a cached binary. 当我检查jenkins构建日志时,看起来它是从缓存的二进制文件中安装软件包的。

Cached binary found at /var/lib/jenkins/.npm/node-sass/4.12.0/linux-x64-57_binding.node
> core-js@2.6.9 postinstall /var/lib/jenkins/workspace/CI-MyProject-Demo/build/exports/MyProject/MyProject-web/node_modules/core-js
> node scripts/postinstall || echo "ignore"

> sauce-connect-launcher@1.2.7 postinstall /var/lib/jenkins/workspace/CI-MyProject-Demo/build/exports/MyProject/MyProject-web/node_modules/sauce-connect-launcher
> node scripts/install.js || nodejs scripts/install.js

> node-sass@4.12.0 postinstall /var/lib/jenkins/workspace/CI-MyProject-Demo/build/exports/MyProject/MyProject-web/node_modules/node-sass
> node scripts/build.js

Binary found at /var/lib/jenkins/workspace/CI-MyProject-Demo/build/exports/MyProject/MyProject-web/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
sfra@4.0.0 /var/lib/jenkins/workspace/CI-MyProject-Demo/build/exports/MyProject/MyProject-web

...
│   └── rimraf@2.7.1 
├── cleave.js@1.5.3 
├─┬ cross-env@5.2.1 
...

Now, the possible solution I can think of is that I can delete /var/lib/jenkins/.npm/node-sass/4.12.0/linux-x64-57_binding.node this file, and it should probably work. 现在,我想到的可能解决方案是可以删除/var/lib/jenkins/.npm/node-sass/4.12.0/linux-x64-57_binding.node这个文件,它应该可以工作。 But I'm not sure if that would break anything else, or if that's the way to go. 但是我不确定这是否会破坏其他东西,或者这是否可行。

Any help is appreciated. 任何帮助表示赞赏。

Instead deleting the module, you could use 代替删除模块,您可以使用

npm cache clean

prior running the install 在运行安装之前

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

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