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
  • 2
  • 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
    Hopefully the answer is helpful. Thoroughly answering questions is time-consuming. If your question is **solved**, please _**accept** the solution_. The **✔** is below the **▲/▼** arrow, at the top left of the answer. A new solution can be accepted if a better one shows up. You may also vote on the usefulness of an answer with the **▲/▼** arrow, if you have a 15+ reputation. **Leave a comment if a solution doesn't answer the question.** [What should I do when someone answers my question?](https://stackoverflow.com/help/someone-answers). Thank you. – Trenton McKinney Sep 27 '21 at 18:12

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
  • 6,005
  • 8
  • 32
  • 48