[英]`npx create-react-app` says it requires "Node 14 or higher" but I'm running 17.4.0. How can I fix this?
I'm trying to start a new React project on my Mac (running Mojave 10.14.5).我正在尝试在我的 Mac 上启动一个新的 React 项目(运行 Mojave 10.14.5)。
In VS Code's Terminal I ran npx create-react-app my-app
and got a message saying that my version of Node was out of date.在 VS Code 的终端中,我运行
npx create-react-app my-app
并收到一条消息,说我的 Node 版本已过时。 I updated node to version 17.4.0 and ran it again - still got the same message.我将节点更新到版本 17.4.0 并再次运行它 - 仍然收到相同的消息。
I then ran clear cache: npm cache clean --force
and tried again - still no luck.然后我运行 clear cache:
npm cache clean --force
并再次尝试 - 仍然没有运气。
node -v
says I'm running 17.4.0. node -v
说我正在运行 17.4.0。
Would anyone know what I could do?有人知道我能做什么吗?
The first thing you need to do is to uninstall the create-react-app and then npm install it again.您需要做的第一件事是卸载 create-react-app,然后再次安装 npm。 You can use these commands for uninstalling the create-react-app: if you are using NPM:
您可以使用以下命令卸载 create-react-app:如果您使用的是 NPM:
npm uninstall -g create-react-app
if you are using Yarn:如果您使用纱线:
yarn global remove create-react-app
for creating new app you can use the following command:要创建新应用程序,您可以使用以下命令:
npx create-react-app@latest your-project-name
You must notice that the create-react-app should not be installed globally as it is documented in Create-React-app Docs .您必须注意到 create-react-app 不应像Create-React-app Docs中所记录的那样全局安装。
Also please note that it is safe to say, always use the LTS version of node (that is 16.13.2 at this time).另请注意,可以肯定地说,始终使用节点的 LTS 版本(此时为 16.13.2)。
It should solve your problem with initiating a new react app.它应该可以解决您启动新反应应用程序的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.