yarn install 报error Couldn‘t find package “core-js@^3.8.3“ required by “@vue/babel-preset-app@^5.0.8

yarn install 报:
1、error Couldn't find package "core-js@^3.8.3" required by "@vue/babel-preset-app@^5.0.8" on the "npm" registry

PS D:\> yarn install
yarn install v1.22.21
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.   
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error Couldn't find package "core-js@^3.8.3" required by "@vue/babel-preset-app@^5.0.8" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


2、error Couldn't find package "fsevents@~2.3.2" required by "chokidar@^3.4.2" on the "npm" registry

PS D:\> yarn install
yarn install v1.22.21
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.   
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error Couldn't find package "fsevents@~2.3.2" required by "chokidar@^3.4.2" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


3、Error: connect ETIMEDOUT 104.16.26.34:443

PS D:\> yarn install    
yarn install v1.22.21
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.   
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error Error: connect ETIMEDOUT 104.16.2.35:443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


等错误都是由资源地址请求超时造成的,更换一下请求地址即可。
解决方案:
运行命令,把资源地址设置成npm淘宝源

yarn config set ignore-engines true

yarn -v  // 查看yarn 版本
yarn config list  // 查看yarn配置
yarn config get registry   // 查看当前yarn源
// 修改yarn源(此处为淘宝的源)
yarn config set registry https://registry.npm.taobao.org
// 修改yarn源(此处为默认的源)
yarn config set registry https://registry.yarnpkg.com


npm config set registry https://registry.npm.taobao.org
npm config set disturl Node.js Mirror
还不行可以尝试:

npm config set proxy http://127.0.0.1:1080
npm i node-sass

// delete proxy
npm config delete proxy

npm config set proxy null
npm config set proxy false
npm cache clean
yarn cache clean

实在不行将报错不能更新的包单个单个安装:

cnpm install --save @vue/shared
cnpm install --save axios
cnpm install --save qs
cnpm install --save lodash-es

参考:yarn报错error An unexpected error occurred: “https://registry.yarnpkg.com...connect ETIMEDOUT...-CSDN博客

你可能感兴趣的:(JavaScript,javascript,vue.js,开发语言)