无法使用npx create-react-app创建新的React应用

问题描述:

我正在尝试使用npx create-react-app [name]命令创建新的react应用.但出现以下错误:

I am trying to create new react app with npx create-react-app [name] command. But I get following error:

错误在"npm"注册表上找不到"babel-preset-react-app@^9.1.2"所需的软件包"@ babel/plugin-transform-flow-strip-types @ 7.9.0".

error Couldn't find package "@babel/plugin-transform-flow-strip-types@7.9.0" required by "babel-preset-react-app@^9.1.2" on the "npm" registry.

每次都说在npm注册表上找不到某些软件包(不仅是@ babel/plugin-transform-flow-strip-types @ 7.9.0该软件包).

Each time it is saying some package could not be found on npm registry (not only @babel/plugin-transform-flow-strip-types@7.9.0 this package).

我也更新了npmnpx,但是没有成功.

I have also updated my npm and npx, but no success.

您可以尝试删除位于Users/you/.npmrc中的.npmrc文件,然后再次运行该命令,似乎npm存在错误,这是一种解决方法

You can try deleting the .npmrc file located in Users/you/.npmrc and run the command again, seems there is a bug with npm and this is a workaround