npm install抛出“使用sha1时完整性校验和失败:想要sha1-6G ... =但得到sha512 ...”错误

时间:2018-10-05 18:40:53

标签: angular npm installation visual-studio-code

我在这里和其他地方检查了一些类似的帖子,但无法弄清楚。从来没有做过Angular,但是得到了安装npm并运行我从未使用过的Angular项目的指导。这是详细信息

在MacBookPro上,我有一个以前从未使用过的Angular项目。我在VSCode中打开它,这是结构

enter image description here

如果我检查npm的版本,则会得到以下信息:

节点10.8.0

npm 6.2.0

,然后转到 src 文件夹的父文件夹(因此包含 src 文件夹的文件夹)并发出:

npm install

,出现以下输出错误。生成的日志文件中存在相同的错误:

mycomp:MyProj nbnex$ npm i
WARN tarball tarball data for angular-tree-component@5.2.1 (sha1-6GFJ7dp3tKYSvYAb/EVjK+zOYGQ=) seems to be corrupted. Trying one more time.
WARN tarball tarball data for angular-tree-component@5.2.1 (sha1-6GFJ7dp3tKYSvYAb/EVjK+zOYGQ=) seems to be corrupted. Trying one more time.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/@angular-devkit/core/node_modules/fsevents):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/Users/dbnex/source/MyProj/MyProj/node_modules/.staging/fsevents-d35eda14/node_modules/yallist' -> '/Users/dbnex/source/MyProj/MyProj/node_modules/.staging/yallist-2c29e2bb'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/watchpack/node_modules/fsevents):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/Users/dbnex/source/MyProj/MyProj/node_modules/.staging/fsevents-6a393e92/node_modules/set-blocking' -> '/Users/dbnex/source/MyProj/MyProj/node_modules/.staging/set-blocking-5346d4b2'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/Users/dbnex/source/MyProj/MyProj/node_modules/.staging/fsevents-a915511c/node_modules/process-nextick-args' -> '/Users/dbnex/source/MyProj/MyProj/node_modules/.staging/process-nextick-args-7b3b7565'

npm ERR! code EINTEGRITY
npm ERR! Verification failed while extracting angular-tree-component@5.2.1:
npm ERR! Verification failed while extracting angular-tree-component@5.2.1:
npm ERR! sha1-6GFJ7dp3tKYSvYAb/EVjK+zOYGQ= integrity checksum failed when using sha1: wanted sha1-6GFJ7dp3tKYSvYAb/EVjK+zOYGQ= but got sha512-EUet5nra7Ia1J4AkdJR6ToUFZHPbN9uybPpv+wx5/jo8lch5ezvh/5MQSShxIeU2bvsv4YpcSqgEq/6iBBfgpQ== sha1-dRAb4fP7cqda60ct3CvKQ5zMJxY=. (178201 bytes)

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dbnex/.npm/_logs/2018-10-05T18_04_47_761Z-debug.log

1 个答案:

答案 0 :(得分:1)

删除node_modules文件夹。使用rimraf可以更快地删除文件夹:

npm install rimraf -g
rimraf node_modules

然后做

 npm install

确保关闭VS Code应用程序。有时,如果在任何应用程序中打开文件夹,都会导致错误。