3

When I run

node -v
v14.17.6

Then I tried

 sudo npx create-react-app custom-hooks

I got

error @typescript-eslint/eslint-plugin@4.15.2: The engine "node" is incompatible with this module. Expected version "^10.12.0 || >=12.0.0". Got "11.10.0" error Found incompatible module info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Can someone help? How I come get this error when terminal told me I have 14.17.6 as I showed. How come it says Got "11.10.0"?

dan
  • 31
  • 3
  • are you see this as a warning in your console while installing packages? or do you get these errors which prevents you from installing CRA? – nima Sep 27 '21 at 12:46
  • @novonimo No this prevents installation – dan Sep 27 '21 at 12:47
  • 1
    are you tried CRA installation without "sudo" ? – nima Sep 27 '21 at 12:48
  • You can try `nvm` and change your node version. You can install multiple node versions using the `nvm`. – Asif vora Sep 27 '21 at 12:54
  • @Asifvora I changed the version to latest using nvm already (14.17.6) as shown. In the error message in my question it says `Got 11.10.0` where does it take it from? – dan Sep 27 '21 at 12:59
  • try `nvm use node version` example : `nvm use 14.17.6` – Asif vora Sep 27 '21 at 13:03
  • 1
    @novonimo It worked without sudo. But it had large delay initially (that was confusing me probably) – dan Sep 27 '21 at 13:03
  • @Asifvora I did that already running without sudo worked – dan Sep 27 '21 at 13:03
  • For more `nvm` explore here how to set up and all https://stackoverflow.com/questions/53785383/how-to-change-node-version-with-nvm/53785482 – Asif vora Sep 27 '21 at 13:03
  • 1
    Try `which node` vs `sudo which node`, and `sudo node -v` You likely have a separate Node 11 which running as sudo prefers. – AKX Sep 27 '21 at 13:04

1 Answers1

2

you are using two different environments or privilege and this is why you get this error.

you are trying to get your node version with:

node -v

you could get it via

sudo node -v

usually, beginners will be caught in this type of problem and it's okay.

Summary: your node version in the actual environment and superuser environment is different and you are trying to scramble them together.

General Advice: don't use sudo before your Linux commands at all and just use it as needed (and you know about it).

nima
  • 7,796
  • 12
  • 36
  • 53