[英]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的版本并安装。安装后,它还会将你刚刚安装的版本设置为活动版本。”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.