繁体   English   中英

为什么 npx create-react-app 显示“该项目是使用旧的不受支持的工具版本引导的”?

[英]Why npx create-react-app is showing "the project was bootstrapped with an old unsupported version of tools"?

我最近切换到 Ubuntu,每当我创建 react 应用程序时,它都会给我这个注释,它正在创建的应用程序是 class 组件。

ankit@gram:~/Documents/Development/React/react-project$ npx create-react-app my-app

Creating a new React app in /home/ankit/Documents/Development/React/react-project/my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...


added 987 packages in 39s

22 packages are looking for funding
  run `npm fund` for details

Success! Created my-app at /home/ankit/Documents/Development/React/react-project/my-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd my-app
  npm start

Happy hacking!

Note: the project was bootstrapped with an old unsupported version of tools.
Please update to Node >=14 and npm >=6 to get supported tools in new projects.

我的节点版本:v16.14.0 我的 npm 版本:8.3.1

我认为这是因为我的系统中没有安装 npx,当我通过这个命令create-react-app创建一个反应应用程序时,创建的应用程序很好。 我还使用这个命令npm install -g npx了 npx 并创建了一个反应应用程序,一切都很好。 在此之前,请确保您已在系统中安装create-react-app ,如果没有,则使用此命令安装它sudo npm install -g create-react-app

我是一个新程序员,不久前我刚刚解决了这个问题。

使用sudo apt install nodejs

它将自动为您安装不接受 React 的版本 10。

然后你尝试安装 NVM 包,用它来更新你的节点到一个更新的版本。

你可以在 GitHub bari racha Wuye 上查看我

我刚安装 Ubuntu 22.04 后遇到了同样的问题。

我的修复是按照这些说明更新节点和 npm 免费代码营更新节点和 npm

具体来说,我按照标题“1.使用 NPM 更新您的节点版本”下的说明来更新节点并忽略第二和第三个标题,然后按照最后一个标题下的说明更新 npm

之后我重新启动计算机,打开项目目录并运行命令

npm 我创建-react-app@latest

然后我跑了

npx create-react-app 项目名称

它按预期工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM