我重新安装了Node.js和Yarn。现在我收到此错误。
我的环境信息是:
节点:v8.12.0
NPM:6.4.1
纱线:1.10.1
OS:Windows 10
PS C:\Users\mdbel\Desktop\Project\redux> npx create-react-app learnredux
Creating a new React app in C:\Users\mdbel\Desktop\Project\redux\learnredux.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.1.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\mdbel\\Desktop\\Project\\redux\\learnredux\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\mdbel\Desktop\Project\redux\learnredux has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
我遇到了同样的问题,并通过以下方式解决了它:
安装节点,npm和yarn的最新版本。
npm install -g npm@latest
nvm install node
npm install -g yarn
当我运行时,因为我使用yarn而不是npm:
yarn cache clean
然后随后调用:
npx create-react-app your-app
工作。
我通过从.yarnrc
删除C:\Users\yourUserName\
文件解决了这个问题>
更新到最新的纱线稳定版本并删除AppData文件夹中的纱线缓存文件夹已解决我的问题C:\ Users \ test \ AppData \ Local \ Yarn
我在Mac上遇到相同的错误。
我在使用npx
时遇到了相同的问题,并能够通过以下步骤解决此问题: