Angular npm安装抛出“;使用sha1时完整性校验和失败:需要sha1-6G…=但得到sha512…“;错误

Angular npm安装抛出“;使用sha1时完整性校验和失败:需要sha1-6G…=但得到sha512…“;错误,angular,npm,installation,visual-studio-code,Angular,Npm,Installation,Visual Studio Code,我在这里和其他地方查看了一些类似的帖子,但没有找到答案。从未做过Angular,但得到指示安装npm并运行一个我以前从未使用过的Angular项目。详情如下 在我的MacBookPro上,我有一个以前从未参与过的现有Angular项目。我用VSCode打开它,这里是结构 如果我检查npm的版本,我会得到以下信息: 节点10.8.0 npm 6.2.0 ,然后我转到src文件夹的父文件夹(包含src文件夹的so文件夹)并发布: npm install ,我得到以下带有错误的输出。生成的日志文件

我在这里和其他地方查看了一些类似的帖子,但没有找到答案。从未做过Angular,但得到指示安装npm并运行一个我以前从未使用过的Angular项目。详情如下

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

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

节点10.8.0

npm 6.2.0

,然后我转到src文件夹的父文件夹(包含src文件夹的so文件夹)并发布:

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

删除
node\u模块
文件夹。使用
rimraf
更快地删除文件夹:

npm install rimraf -g
rimraf node_modules
那就做吧

 npm install

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

删除package-lock.json并再次尝试npm安装,但没有work@ShubhamYerawar这对我来说很管用,感谢可能的复制品