【问题标题】:npm WARN tar ENOENT no such file or directory node_modules/.staging/typescript-8be04997/lib/zh-CN/diagnosticMessages.generated.jsonnpm WARN tar ENOENT 没有这样的文件或目录 node_modules/.staging/typescript-8be04997/lib/zh-CN/diagnosticMessages.generated.json
【发布时间】:2019-10-03 21:38:57
【问题描述】:

我正在运行 npm install 我有一个特定于机器的 package.json 和 package-lock.json,所以我无法更改它。 我在linux上 我没有 sudo 访问权限 错误

npm WARN notice [SECURITY] static-eval has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=static-eval&version=2.0.2 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] timespan has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=timespan&version=2.3.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] open has the following vulnerability: 1 critical. Go here for more details: https://nodesecurity.io/advisories?search=open&version=6.0.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] tunnel-agent has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=tunnel-agent&version=0.4.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] hoek has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=hoek&version=2.16.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN tar ENOENT: no such file or directory, open '/.../node_modules/.staging/typescript-8be04997/lib/zh-CN/diagnosticMessages.generated.json'
npm ERR! code EINTEGRITY
npm ERR! sha512-A4E89MA+kto8giic7zyLU6ZxfXnVeCUlKOyzFsah3+n4BROx4bgonl92KIBtwLud/mIWir8ahqhuhe2by9LakQ== integrity checksum failed when using sha512: wanted sha512-A4E89MA+kto8giic7zyLU6ZxfXnVeCUlKOyzFsah3+n4BROx4bgonl92KIBtwLud/mIWir8ahqhuhe2by9LakQ== but got sha512-x1FIOIOdtF5FC5f7q1galS64Nd4mtcgjdIPX7tV7NkNPotDdmov1DjLrAuGTEFme+0R8N2plqO29pp9IEUXb5Q==. (7879388 bytes)

npm ERR! A complete log of this run can be found in:

日志 在此输入代码

30346 verbose stack Error: sha512-A4E89MA+kto8giic7zyLU6ZxfXnVeCUlKOyzFsah3+n4BROx4bgonl92KIBtwLud/mIWir8ahqhuhe2by9LakQ== integrity checksum failed when using sha512: wanted sha512-A4E89MA+kto8giic7zyLU6ZxfXnVeCUlKOyzFsah3+n4BROx4bgonl92KIBtwLud/mIWir8ahqhuhe2by9LakQ== but got sha512-x1FIOIOdtF5FC5f7q1galS64Nd4mtcgjdIPX7tV7NkNPotDdmov1DjLrAuGTEFme+0R8N2plqO29pp9IEUXb5Q==. (7879388 bytes)
30346 verbose stack     at Transform.on (/home/x86_64-unknown-linux_ol7-gnu/node-v8.11.1/lib/node_modules/npm/node_modules/ssri/index.js:275:19)
30346 verbose stack     at emitNone (events.js:111:20)
30346 verbose stack     at Transform.emit (events.js:208:7)
30346 verbose stack     at endReadableNT (_stream_readable.js:1064:12)
30346 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
30346 verbose stack     at process._tickCallback (internal/process/next_tick.js:180:9)
30347 verbose [folder where I run npm install]
30348 verbose Linux 3.10.0-957.12.1.el7.x86_64
30349 verbose argv "/home/x86_64-unknown-linux_ol7-gnu/node-v8.11.1/bin/node" "/home/x86_64-unknown-linux_ol7-gnu/node-v8.11.1/bin/npm" "install"
30350 verbose node v8.11.1
30351 verbose npm  v5.6.0
30352 error code EINTEGRITY
30353 error sha512-A4E89MA+kto8giic7zyLU6ZxfXnVeCUlKOyzFsah3+n4BROx4bgonl92KIBtwLud/mIWir8ahqhuhe2by9LakQ== integrity checksum failed when using sha512: wanted sha512-A4E89MA+kto8giic7zyLU6ZxfXnVeCUlKOyzFsah3+n4BROx4bgonl92KIBtwLud/mIWir8ahqhuhe2by9LakQ== but got sha512-x1FIOIOdtF5FC5f7q1galS64Nd4mtcgjdIPX7tV7NkNPotDdmov1DjLrAuGTEFme+0R8N2plqO29pp9IEUXb5Q==. (7879388 bytes)
30354 verbose exit [ 1, true ]

我希望 npm install 能够真正工作

【问题讨论】:

  • “npm WARN tar ENOENT no such file or directory node_modules”在标题中,但不在问题的正文中,请粘贴所有错误消息。

标签: node.js angular typescript npm package.json


【解决方案1】:

在尝试了许多方法(包括升级npm)后,对我来说有帮助的是:

  • rm -rf node_modules package-lock.json
  • npm install

关键是我相信要删除 package-lock.jsonnode_modules

这很可能与在已安装模块的分支之间切换有关。

【讨论】:

  • 这帮助我在执行“npm cache clean --force”命令后解决了几个错误。
  • 不建议删除package-lock.json
  • 您的评论对我有用“关键是我相信删除 package-lock.json 和 node_modules。”
【解决方案2】:

您可以通过以下方法解决该问题:

1.确保在 package.json 上正确描述依赖项

2.只需键入 npm install 并按 Enter。

3.检查问题依然存在。如果问题没有解决,请继续这些方法。

4.输入 npm cache clean 并回车

5. 键入 sudo npm install -g npm 并按 Enter。

6.重试 npm install 并按 Enter。

【讨论】:

  • npm cache clean 究竟做了什么
  • "npm cache clean" 从版本 5 开始不再存在于 npm 中。可能有帮助的命令是“npm cache verify”或在 npm 版本 5 及更高版本中完全删除缓存运行“npm cache clean --force”。
猜你喜欢
  • 2020-04-08
  • 2020-02-23
  • 2018-01-13
  • 2019-04-13
  • 1970-01-01
  • 2021-01-10
  • 2021-06-10
  • 2018-10-26
  • 2023-01-02
相关资源
最近更新 更多