简体   繁体   English

由于节点版本问题,无法安装 react-app 但我确实安装了最新版本

[英]Cannot install react-app because of a node version problem but I do have the last version installed

All is in the title: I am trying to create a react-app following this tutorial: https://github.com/facebook/create-react-app一切都在标题中:我正在尝试按照本教程创建一个反应应用程序: https : //github.com/facebook/create-react-app

But it fails immediately saying the following:但它立即失败,说以下内容:


[user@localhost workspace]$ create-react-app projectname
Creating a new React app in projectpath/projectname.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.6.0
info No lockfile found.
[1/4] Resolving packages...
warning react-scripts > workbox-webpack-plugin > workbox-build > strip-comments > babel-plugin-transform-object-rest-spread > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
[2/4] Fetching packages...
error eslint@6.7.2: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts --cwd projectpath/projectname has failed.

From "The engine "node" is incompatible with this module. Expected version" I deduce that my node is not up to date.从“引擎“节点”与此模块不兼容。预期版本”我推断我的节点不是最新的。 However:然而:

sudo n stable gives me: installed : v12.13.1 to /usr/local/bin/node active : v10.16.3 at /bin/node sudo n stable给了我:已安装:v12.13.1 到 /usr/local/bin/node active :v10.16.3 at /bin/node

nvm use stable gives me: Now using node v10.0.0 (npm v6.13.4) nvm use stable给了我:现在使用节点 v10.0.0 (npm v6.13.4)

node -v gives me: v10.0.0 node -v给我: v10.0.0

Anyone has an idea to solve this problem?任何人都有解决这个问题的想法? Thank you in advance for your answers.预先感谢您的回答。

OK I finally found how to use the version I want thanks to the following resources https://alligator.io/nodejs/node-version-manager/好的,我终于找到了如何使用我想要的版本,这要归功于以下资源https://alligator.io/nodejs/node-version-manager/

I don't know why I was always stuck with the version 10.0.0.我不知道为什么我总是卡在 10.0.0 版本上。 I even uninstalled and reinstalled npm and node specifying I wanted the last version of node and it reinstalled me the 10.0.0 version...我什至卸载并重新安装了 npm 和 node,指定我想要 node 的最后一个版本,它重新安装了 10.0.0 版本...

The link above provide the following magic command:上面的链接提供了以下魔术命令:

nvm install 12

It downloads AND setup the version 12 of node as ACTIVE :它将 node 的版本 12 下载设置为ACTIVE

"Upon running each command, nvm will download the version of Node.js from the official website and install it. Once installed, it will also set the version you just installed as the active version." “每次运行命令,nvm都会从官网下载Node.js的版本并安装。安装后,它还会将你刚刚安装的版本设置为活动版本。”

I found an issue on that topic on GitHub.我在 GitHub 上发现了有关该主题的问题

The last comment says that you have to run all these commands:最后一条评论说你必须运行所有这些命令:

npm install npm@latest -g
sudo npm cache clean -f
sudo npm install -g n
sudo n stable

and then you should be fine然后你应该没事

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

相关问题 我已经安装了Node 10时,如何安装LJS版本的NodeJS? - How do install the LTS version of NodeJS when I already have Node 10 installed? 无论如何我可以解决这个反应应用程序问题吗? 一直无法启动开发服务器 - Is there anyway I can fix this react-app problem? Have not been able to start the development sever 我是否需要安装 babel 才能在我的 react-app 中编写 ES6 代码? - Do I need to install babel to be able to write ES6 code in my react-app? 我的 React 版本有问题 - I have a problem with my version of React 我怎么知道我安装了哪个版本的 gjslint? - how do I know what version of gjslint I have installed? 由于 node 和 webpack 版本冲突,无法安装依赖项 - can't install dependencies because of node and webpack version conflict react app 5.0.0新版如何安装 - how to install the new version of react app 5.0.0 为什么在我安装节点 10.1.0 之后它说安装的版本是 5.6.0? - Why after that I installed node 10.1.0 it says that the installed version is the 5.6.0? 使用旧版本的节点创建 React App - Create React App with an older version of node 'npm 是否安装'l<package_name> 安装一个package的最新版本还是安装最新版本的node兼容?</package_name> - Does 'npm instal'l <package_name> install the latest version of a package or the latest compatible with the version of node installed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM