Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 > [email protected]: 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 > [email protected]: use String.prototype.padStart()
[2/4] Fetching packages...
error [email protected]: 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

nvm use stable gives me: Now using node v10.0.0 (npm v6.13.4)

node -v gives me: v10.0.0

Anyone has an idea to solve this problem? Thank you in advance for your answers.

like image 561
ava_punksmash Avatar asked Apr 28 '26 18:04

ava_punksmash


1 Answers

OK I finally found how to use the version I want thanks to the following resources https://alligator.io/nodejs/node-version-manager/

I don't know why I was always stuck with the version 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...

The link above provide the following magic command:

nvm install 12

It downloads AND setup the version 12 of node as 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."

like image 186
ava_punksmash Avatar answered Apr 30 '26 07:04

ava_punksmash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!