我在这里和其他地方检查了一些类似的帖子,但无法弄清楚。从未做过 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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9afbf4fdeff6fbe8b7eee8ffffb7f9f5f7eaf5f4fff4eedaafb4a8b4ab" rel="noreferrer noopener nofollow">[email protected]</a> (sha1-6GFJ7dp3tKYSvYAb/EVjK+zOYGQ=) seems to be corrupted. Trying one more time.
WARN tarball tarball data for <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f7e71786a737e6d326b6d7a7a327c70726f70717a716b5f2a312d312e" rel="noreferrer noopener nofollow">[email protected]</a> (sha1-6GFJ7dp3tKYSvYAb/EVjK+zOYGQ=) seems to be corrupted. Trying one more time.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5b3d283e2d3e352f281b6a7569756f" rel="noreferrer noopener nofollow">[email protected]</a> (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: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6f091c0a190a011b1c2f5e415d415b" rel="noreferrer noopener nofollow">[email protected]</a> (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: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7016031506151e040330415e425e44" rel="noreferrer noopener nofollow">[email protected]</a> (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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ff9e91988a939e8dd28b8d9a9ad29c90928f90919a918bbfcad1cdd1ce" rel="noreferrer noopener nofollow">[email protected]</a>:
npm ERR! Verification failed while extracting <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90f1fef7e5fcf1e2bde4e2f5f5bdf3fffde0fffef5fee4d0a5bea2bea1" rel="noreferrer noopener nofollow">[email protected]</a>:
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_modules
文件夹。使用rimraf
可以更快地删除文件夹:
npm install rimraf -g
rimraf node_modules
然后做
npm install
确保关闭 VS Code
应用程序。有时,如果在任何应用程序中打开该文件夹,都会导致错误。
关于angular - npm install 抛出 "integrity checksum failed when using sha1: wanted sha1-6G...= but got sha512..."错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52671571/