简体   繁体   English

`npx create-react-app` 说它需要“节点 14 或更高版本”,但我运行的是 17.4.0。 我怎样才能解决这个问题?

[英]`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.

相关问题 create-react-app 说“Create React App 需要 Node 14 或更高版本。” 修复节点给出“npm 不支持 Node.js v10.19.0” - create-react-app says "Create React App requires Node 14 or higher." Fixing node gives "npm does not support Node.js v10.19.0" Create-React-App需要Node 4.0或更高版本 - Create-React-App requires Node 4.0 or higher Create-React-App需要Node 4.0或更高版本-在Windows上 - Create-React-App requires Node 4.0 or higher - on Windows 我无法使用 npx create-react-app 安装反应,这是 aNodist 的问题吗? - I can't install react using npx create-react-app is this aNodist the issue? 您正在运行节点 12.13.0。 Create React App 需要 Node 14 或更高版本。 请更新您的节点版本 - You are running Node 12.13.0. Create React App requires Node 14 or higher. Please update your version of Node 在全新安装 node.js 时运行 npx create-react-app myapp 时出错 - Error when running npx create-react-app myapp on fresh install of node.js NPX create-react-app 终端告诉我没有安装节点,但它是 - NPX create-react-app terminal tells me node is not installed but it is 我无法通过“create-react-app”创建反应应用程序 - I'm not able to create react app by "create-react-app" 运行 npx create-react-app 时遇到错误 - Facing error while running npx create-react-app 我无法通过“create-react-app”创建反应应用程序 - I'm not able to create react app by “create-react-app”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM