Manu
Manu

Reputation: 396

different node version conflicts while npm install

I got this issue everytime I want to do npx create-react-app my_app

yarn add v1.15.2
[1/4] šŸ”  Resolving packages...
[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". Got "8.3.0"

But when I do check my versions with nvm and bash here's what I got

$ node -v
v8.16.1
$ npm -v
6.4.1
$ nvm ls
nvm ls
->      v8.16.1
        v9.10.1
        v12.0.0
         system
default -> node (-> v12.0.0)
node -> stable (-> v12.0.0) (default)
stable -> 12.0 (-> v12.0.0) (default)
iojs -> N/A (default)
lts/* -> lts/dubnium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.16.1
lts/dubnium -> v10.16.3 (-> N/A)

I really don't get why it says while doing the npx command that I got node 8.3.0 and that version appears nowhere

It may be because I've installed node with brew some times ago and it may conflict with nvm settings?


It works when I issue npm install -g create-react-app and create-react-app my-app separately as it's what facebook recommends for old node version

$ npm install -g create-react-app
+ [email protected]
added 91 packages from 45 contributors in 4.491s

$ create-react-app trainin
yarn add v1.15.2
[1/4] šŸ”  Resolving packages...
[2/4] šŸšš  Fetching packages...
[3/4] šŸ”—  Linking dependencies...
warning "react-scripts > @typescript-eslint/[email protected]" has incorrect peer dependency "eslint@^5.0.0".
warning "react-scripts > @typescript-eslint/[email protected]" has incorrect peer dependency "eslint@^5.0.0".
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] šŸ”Ø  Building fresh packages...
success Saved lockfile.
success Saved 7 new dependencies.
info Direct dependencies
ā”œā”€ [email protected]
ā”œā”€ [email protected]
ā””ā”€ [email protected]
info All dependencies
ā”œā”€ [email protected]
ā”œā”€ [email protected]
ā”œā”€ [email protected]
ā”œā”€ [email protected]
ā”œā”€ [email protected]
ā”œā”€ [email protected]
ā””ā”€ [email protected]
āœØ  Done in 15.45s.

Upvotes: 0

Views: 3940

Answers (2)

Farhan
Farhan

Reputation: 1505

You can use n package which allow you to switch between multiple node versions

Upvotes: 1

polunzh
polunzh

Reputation: 318

You'd better uninstall the version installed by brew, and setup the default version compatible with npx required.

Upvotes: 1

Related Questions