无法创建反应项目
我正在尝试使用 npm 创建一个 React 项目,但我失败了,因为不再支持 npm-create-react 的全局版本,但即使我按照告诉我的去做,它也不起作用。 当我尝试使用该命令时,
npm init react-app my-app
我从控制台收到此错误
Need to install the following packages:
create-react-app
Ok to proceed? (y) y
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
npm ERR! code 1
npm ERR! path /Users/nick/Documents/NFT
npm ERR! command failed
npm ERR! command sh -c create-react-app "my-app"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nick/.npm/_logs/2022-02-26T08_47_03_397Z-debug.log
在收到此错误后,我键入命令
npm uninstall -g create-react-app
并在终端中打印以下消息:
up to date, audited 1 package in 110ms
found 0 vulnerabilities
在此之后没有任何更改,我仍然收到相同的错误。 我怎样才能删除这个? 先感谢您。
I'm trying to create a React project using npm but I'm failing because the global version of npm-create-react is no longer supported but even I follow what is told me to do it doesn't work anyway.
When I try to use the command
npm init react-app my-app
I get this error from the console
Need to install the following packages:
create-react-app
Ok to proceed? (y) y
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
npm ERR! code 1
npm ERR! path /Users/nick/Documents/NFT
npm ERR! command failed
npm ERR! command sh -c create-react-app "my-app"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nick/.npm/_logs/2022-02-26T08_47_03_397Z-debug.log
After I receive this error I type the command
npm uninstall -g create-react-app
And in the terminal it gets printed the following message:
up to date, audited 1 package in 110ms
found 0 vulnerabilities
After this nothing changes, I still get the same error.
How can I remove this?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试从 npx 运行 create React 应用程序,如下所示
npx create-react-app app-name
try running the create react app from npx like this
npx create-react-app app-name
我通过使用这个命令使它工作
然后我可以再次使用
I made it work by using this command
Then I could use again
您的计算机上需要有 Node >= 14.0.0 和 npm >= 5.6。要创建项目,请运行:
Link for doc
You’ll need to have Node >= 14.0.0 and npm >= 5.6 on your machine. To create a project, run:
Link for doc