yarn安装依赖报错Error: ENOENT: no such file or directory?

作者站长头像
站长
· 阅读数 5

执行安装命令yarn报错以下信息

[1/5] 🔍  Validating package.json...
warning knight-operation: "dependencies" has dependency "@testing-library/jest-dom" with range "^4.2.4" that collides with a dependency in "devDependencies" of the same name with version "^5.11.6"
warning knight-operation: "dependencies" has dependency "@testing-library/react" with range "^9.3.2" that collides with a dependency in "devDependencies" of the same name with version "^11.2.2"
[2/5] 🔍  Resolving packages...
warning Resolution field "css-loader@3.4.2" is incompatible with requested version "css-loader@4.3.0"
[3/5] 🚚  Fetching packages...
error http://registry.m.jd.com/fsevents/download/fsevents-1.2.7.tgz: Integrity check failed for "fsevents" (computed integrity doesn't match our records, got "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw== sha1-Z79X9HWPAu3oj7KhcS/vTRU1i+M=")
[4/5] 🔗  Linking dependencies...
warning " > css-loader@3.4.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning " > @dada/custom@0.2.10" has incorrect peer dependency "lodash@^4.17.15".
warning "webpack-config-single-spa-react > webpack-config-single-spa > standalone-single-spa-webpack-plugin@1.2.1" has unmet peer dependency "webpack@*".
error Error: ENOENT: no such file or directory, open '/Users/wangling86/Library/Caches/Yarn/v6/npm-fsevents-1.2.11-4851b664a3783e52003b3c66eb0eee1074933aa4-integrity/node_modules/fsevents/.yarn-metadata.json'
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

请问如何解决呀,试了网上找到的很多方法都无效,如下,求助

yarn cache clean

yarn install --network-timeout 10000000

yarn install --network-concurrency 1

rm -rf node_modules **/node_modules

rm -rf yarn.lock **/yarn.lock

yarn config set "strict-ssl" false -g
回复
1个回答
avatar
test
2024-06-19

真正的错误原因是这个, 远程库的签名和期望值(yarn.lock中记录的上次安装的)不一致Integrity check failed for "fsevents"

解决:

  1. 清理缓存:执行命令yarn cache clean
  2. 更新本地包的签名:执行命令yarn --update-checksums
回复
likes
适合作为回答的
  • 经过验证的有效解决办法
  • 自己的经验指引,对解决问题有帮助
  • 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
  • 询问内容细节或回复楼层
  • 与题目无关的内容
  • “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容