[英]How can I use the latest react version (react18)?
When using npx create-react-app my-app, I got this error:使用 npx create-react-app my-app 时,我得到了这个错误:
You are running
create-react-app
4.0.3, which is behind the latest release (5.0.1).您正在运行
create-react-app
4.0.3,它落后于最新版本 (5.0.1)。 We no longer support global installation of Create React App.我们不再支持全局安装 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
请使用以下命令之一删除任何全局安装:- npm uninstall -g create-react-app - yarn global remove create-react-app
I used the command npm uninstall and also check out the getting started with react我使用命令 npm uninstall 并检查了getting started with react
but that links suggest the same process of npx create-react-app my-app.但该链接表明 npx create-react-app my-app 的过程相同。 I also used this command
npm install react react-dom
but this我也使用了这个命令
npm install react react-dom
但是这个
only install a node modules and a package.json.只安装一个节点模块和一个 package.json。 It doesn't create the usual react boilerplate and all.
它不会创建通常的反应样板和所有内容。 Anyone have any idea, please help.
任何人有任何想法,请帮助。
Try this solution:试试这个解决方案:
npx create-react-app@latest myApp
You first need to uninstall the glocal app and then clear the cache and then reinstall it.您首先需要卸载 glocal 应用程序,然后清除缓存,然后重新安装。
npm uninstall -g create-react-app
npx clear-npx-cache
After doing this reinstall it by running following command执行此操作后,通过运行以下命令重新安装它
npx create-react-app my-app
If it still don't work make sure to update your npm and node version.如果它仍然不起作用,请确保更新您的 npm 和节点版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.