5

当我尝试使用 create-react-app 创建一个新的 react 应用程序时,我得到了以下信息:

» npx create-react-app my-order

Creating a new React app in /Users/ian/myproject/my-order.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.19.0
[1/4]   Resolving packages...
[2/4]   Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/ian/myproject/my-order/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 /Users/ian/myproject/my-order has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.

而我的本地环境信息是这样的:

» npx create-react-app --info

Environment Info:

  System:
    OS: macOS 10.14.6
    CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  Binaries:
    Node: 11.1.0 - /usr/local/bin/node
    Yarn: 1.19.0 - ~/.yarn/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 80.0.3987.100
    Firefox: 72.0.2
    Safari: 12.1.2
  npmPackages:
    react: Not Found
    react-dom: Not Found
    react-scripts: Not Found
  npmGlobalPackages:
    create-react-app: 2.1.1

有人知道这里发生了什么吗?

4

3 回答 3

2

在你的命令中试试这个: - yarn cache clean - yarn 它可能会工作......

于 2020-05-27T10:49:37.980 回答
2

有时访问 npmjs.com 和安装范围包时会出现问题。尝试检查https://status.npmjs.org/

于 2020-08-06T11:03:21.813 回答
0

如果您使用 NVM,如果您从最初安装的主要 nodejs 版本切换出去,则可能会出现此问题,因此如果可以的话,只需改回:nvm use <original node installation's version>

但是,如果这对您不起作用,那么如果我不能只使用非 NVM 安装,那么我会尝试直接从网站重新安装节点:https ://nodejs.org/en/

对于某些人来说,他们似乎遇到了 EACCESS 错误,这可以通过将注册表从 http 更改为 https 来解决:npm install --registry=https://registry.npmjs.org/

类似的问题:无法从 nvm 运行 npm install,但使用来自 https://nodejs.org/en/download/ 的源代码运行良好

于 2021-12-08T14:55:16.710 回答