首页 > 解决方案 > 我尝试使用 powershell 安装 yarn 包。首先我输入了 npm install -g yarn 然后我输入了 yarn install。但我收到以下错误

问题描述

我尝试使用管理权限打开 Powershell 并输入 set-executionpolicy remote signed 然后再次尝试,但我仍然遇到错误。

yarn install
yarn install v1.22.11
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...
warning react-scripts > webpack-dev-server > sockjs > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[2/4] Fetching 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 An unexpected error occurred: "https://registry.yarnpkg.com/@material-ui/icons/-/icons-4.9.1.tgz: ESOCKETTIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Win8\\Documents\\Masters Software Engineering\\upstac-ui\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

标签: powershellnpmyarnpkg

解决方案


这对我有用,我制作了一个文件并将其命名

.yarnrc

并将其放入其中

网络超时 500000

看一看:

https://github.com/mui/material-ui/issues/12432


推荐阅读