我已经在我的笔记本电脑上反应了本机项目。当我将项目转移到我的电脑并运行yarn install(我使用yarn安装了一些模块,一些使用npm安装了)时,我得到了
发生意外错误:“https://registry.yarnpkg.com/jest/-/jest-23.0.0-alpha.0.tgz:请求失败\“404 Not Found\””。
我的电脑和笔记本电脑上的 Yarn 版本相同
1.5.1
npm 版本我的电脑和 latop 相同
5.4.1
节点版本
v 7.9.0
此外,在我的项目上运行yarn install 时我收到警告
warning You are using Node "7.9.0" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
我找到了解决办法
yarn config set registry https://registry.npmjs.org
rm yarn.lock
yarn
我今天在 CircleCI 中遇到了这个问题,原来是缓存问题:
yarn cache clean
yarn install
实际上我必须运行
yarn install
两次,但不知道为什么。
我遇到了类似的问题,得到:
An unexpected error occurred: "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.14.0.tgz: Request failed \"404 Not Found\"".
删除
yarn.lock
并运行 yarn
可能会导致大量软件包被升级,并可能导致其他配置问题。
相反,我只是从
es-abstract
中删除了 yarn.lock
分辨率部分,例如:
es-abstract@^1.11.0, es-abstract@^1.5.1, es-abstract@^1.7.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.14.0.tgz#f59d9d44278ea8f90c8ff3de1552537c2fd739b4"
integrity sha512-lri42nNq1tIohUuwFBYEM3wKwcrcJa78jukGDdWsuaNxTtxBFGFkKUQ15nc9J+ipje4mhbQR6JwABb4VvawR3A==
dependencies:
es-to-primitive "^1.2.0"
function-bind "^1.1.1"
has "^1.0.3"
has-symbols "^1.0.0"
is-callable "^1.1.4"
is-regex "^1.0.4"
object-inspect "^1.6.0"
object-keys "^1.1.1"
string.prototype.trimleft "^2.0.0"
string.prototype.trimright "^2.0.0"
并运行
yarn
。这通过最少的升级解决了问题 yarn.lock
。
就我而言,如果是无效的nodejs版本。安装已完成
v20
,我尝试在活动为 v18
时运行。
nvm use v20
yarn # works fine
以下工作适用于
npm
npm config set registry https://registry.npmjs.org
rm package.json && rm nodemodules
npm install