npm 错误!尝试获取 http://registry.npmjs.org/accepts 时响应正文无效:sha 完整性验证失败

问题描述 投票:0回答:4

npm 错误!尝试获取 http://registry.npmjs.org/accepts 时响应正文无效:

的完整性验证失败

尝试安装 Angular cli 和 Express 时,我的 RPI4 (raspbian) 上出现此错误。我按照另一个线程中的建议降级到 npm 6.13.7,但没有成功。

npm angular-cli
4个回答
66
投票

尝试清除缓存并重新安装

npm cache clear --force
npm install

13
投票

npm cache verify

npm install

以上对我有帮助。
请参阅不带

npm cache clean
键的
--force
命令输出的详细信息。
就我而言,是

$ npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues
npm ERR! by treating integrity mismatches as cache misses.  As a result,
npm ERR! data extracted from the cache is guaranteed to be valid.  If you
npm ERR! want to make sure everything is consistent, use `npm cache verify`
npm ERR! instead.  Deleting the cache can only make npm go slower, and is
npm ERR! not likely to correct any problems you may be encountering!
npm ERR! 
npm ERR! On the other hand, if you're debugging an issue with the installer,
npm ERR! or race conditions that depend on the timing of writing to an empty
npm ERR! cache, you can use `npm install --cache /tmp/empty-cache` to use a
npm ERR! temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command
npm ERR! with --force.

0
投票

清除缓存将解决该问题:

sudo npm cache clear --force

0
投票

我跑步

sudo npm cache clear --force

然后我得到了这个

然后我就跑

sudo chown -R 501:20 "/Users/sameermuslim/.npm"

然后

npm install

完成。

© www.soinside.com 2019 - 2024. All rights reserved.