创建软件包时,在“ npm”注册表上找不到软件包“ react”

时间:2020-07-31 03:54:36

标签: reactjs npm create-react-app npx

我正在尝试创建一个新的react项目并在以下命令中使用

npx create-react-app login

安装失败,并说“在“ npm”注册表中找不到软件包“ react””。

消息:

Creating a new React app in C:\Amit\Code\Experiment\TestConsoleApp\login.

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

yarn add v1.7.0
[1/4] Resolving packages...
error Couldn't find package "react" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this comm
and.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd C:\Amit\C
ode\Experiment\TestConsoleApp\login has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting login/ from C:\Amit\Code\Experiment\TestConsoleApp
Done.

2 个答案:

答案 0 :(得分:3)

npm config set registry https://registry.npmjs.org/

...在遇到相同错误时为我工作

答案 1 :(得分:0)

尝试删除npm注册表

npm config delete registry