gpt4 book ai didi

node.js - npm install `npm WARN tar zlib: incorrect data check` 出现错误

转载 作者:行者123 更新时间:2023-12-03 07:12:20 81 4
gpt4 key购买 nike

发生了什么?当我从项目目录运行 npm install 时,我会看到以下消息:

npm WARN tar zlib: incorrect data check
npm WARN tarball cached data for acorn@https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz (sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==) seems to be corrupted. Refreshing cache.
npm WARN tar zlib: incorrect data check
npm WARN tarball cached data for regexpp@https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz (sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==) seems to be corrupted. Refreshing cache.
npm WARN deprecated <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e08020f1a1a0b002e5f405e405d" rel="noreferrer noopener nofollow">[email protected]</a>: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN tarball tarball data for regexpp@https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz (sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==) seems to be corrupted. Trying again.
npm WARN tarball tarball data for acorn@https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz (sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==) seems to be corrupted. Trying again.
npm WARN tar TAR_ENTRY_INVALID checksum failure
npm WARN tar zlib: incorrect data check
npm WARN tarball tarball data for @angular/compiler@https://registry.npmjs.org/@angular/compiler/-/compiler-8.2.14.tgz (sha512-ABZO4E7eeFA1QyJ2trDezxeQM5ZFa1dXw1Mpl/+1vuXDKNjJgNyWYwKp/NwRkLmrsuV0yv4UDCDe4kJOGbPKnw==) seems to be corrupted. Trying again.
npm WARN tarball tarball data for @angular/compiler@https://registry.npmjs.org/@angular/compiler/-/compiler-8.2.14.tgz (sha512-ABZO4E7eeFA1QyJ2trDezxeQM5ZFa1dXw1Mpl/+1vuXDKNjJgNyWYwKp/NwRkLmrsuV0yv4UDCDe4kJOGbPKnw==) seems to be corrupted. Trying again.
npm ERR! code ENOENT
npm ERR! syscall stat
npm ERR! path /Users/USERNAME/.npm/_cacache/content-v2/sha512/00/16/4ee04ede785035432276b6b0decf17903396456b5757c3532997ffb5bee5c328d8c980dc966302a9fcdc1190b9abb2e574cafe140c20dee2424e19b3ca9f
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, stat '/Users/USERNAME/.npm/_cacache/content-v2/sha512/00/16/4ee04ede785035432276b6b0decf17903396456b5757c3532997ffb5bee5c328d8c980dc966302a9fcdc1190b9abb2e574cafe140c20dee2424e19b3ca9f'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/USERNAME/.npm/_logs/2023-01-31T17_52_09_696Z-debug-0.log

这是我的 package.json:

{
"name": "my-api",
"version": "2.0.0",
"description": "",
"scripts": {
"dev": "docker-compose up -d; aws-vault exec nonprod -- sam local start-api -t sam-update.yml --docker-network sam-local --env-vars env.json",
"build": "bash -c './bin/build.sh'",
"deploy": "bash -c './bin/deploy.sh $npm_package_name $0 $1'",
"invoke": "sam local invoke -t sam-update.yml --docker-network sam-local --env-vars env.json",
"lint": "prettier-standard --format --lint './src/**/*.{js,jsx,ts,tsx,css,scss}'",
"lint-ci": "prettier-standard --lint './src/**/*.{js,jsx,ts,tsx,css,scss}'",
"meta": "bash -c './bin/meta.sh $npm_package_name $0 $1'",
"package": "bash -c './bin/package.sh $npm_package_name $0 $1'",
"postinstall": "pip install -r requirements-dev.txt && husky install",
"setup": "bash -c './bin/setup.sh $npm_package_name $0 $1'",
"test": "NODE_ENV=test jest -u",
"test:coverage": "mkdir -p ./src/coverage ; NODE_ENV=test jest --coverage | tee ./src/coverage/coverage.txt",
"test-ci": "NODE_ENV=test jest --silent",
"update": "bash -c './bin/update.sh $npm_package_name $0 $1'"
},
"license": "CC BY-SA",
"keywords": [],
"devDependencies": {
"husky": "^5.2.0",
"jest": "^29.3.1",
"prettier-standard": "^16.4.1"
},
"overrides": {
"find-parent-dir": "0.3.1"
},
"eslintConfig": {
"env": {
"jest": true,
"node": true,
"es6": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"ignorePatterns": [
"**/node_modules/**",
"**/*.spec.js"
]
},
"jest": {
"coverageReporters": [
"json-summary",
"text"
],
"collectCoverageFrom": [
"<rootDir>/**/*.js"
],
"setupFiles": [
"<rootDir>/../.jest/setEnvVars.js"
],
"modulePaths": [
"<rootDir>/layers/AuthorizerLayer/nodejs/node_modules",
"<rootDir>/layers/PlagiarismLayer/nodejs/node_modules",
"<rootDir>/layers/WebsocketLayer/nodejs/node_modules"
],
"moduleNameMapper": {
"/opt/(\\w*)": "<rootDir>/../src/layers/$1/$1.js",
"aws-sdk": "<rootDir>/../__mocks__/aws-sdk",
"aws-xray-sdk": "<rootDir>/../__mocks__/aws-xray-sdk"
},
"rootDir": "./src",
"testEnvironment": "node"
},
"prettier": {
"semi": true,
"trailingComma": "es5",
"arrowParens": "avoid",
"singleQuote": true
}
}

我尝试修复的问题:我做的第一件事是使用 npm install --cache=/tmp/cache/设置临时缓存位置,但这并没有解决问题。在那之后,我开始提出解决方案,希望在没有完全理解发生了什么的情况下能够发挥作用。还应该注意,我做的第一件事是删除存储库中的所有 node_modules 和 package-lock.json 文件。

  • 我运行了npm cache clean
  • 从我的本地计算机中删除了存储库并重新克隆
  • 卸载 Node 版本(通过 nvm)并重新安装
  • 完全卸载了node和nvm,删除了Mac上的.node.npm以及所有其他*node*文件夹,然后重新启动并重新安装了nvm和node

毕竟,仍然收到相同的错误消息。如果在我的计算机上创建一个新目录并初始化 package.json,然后运行 ​​npm install --save-dev husky prettier-standard jest ,一切都会安装得很好。让我相信这是存储库的问题,但是,我的团队中没有其他人在他们的计算机上使用相同的存储库遇到此问题。所以不确定发生了什么或如何解决它。

最佳答案

就我而言,我只需删除 node_modules 目录和 package-lock.json

关于node.js - npm install `npm WARN tar zlib: incorrect data check` 出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75301499/

81 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com