facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.69k stars 26.84k forks source link

Error in create-react-app while running nightly versions of Node #4213

Closed user135711 closed 5 years ago

user135711 commented 6 years ago

I'm running above node version 6, but creating the site fails with error:

You are using Node v10.0.0-nightly201803206a958d2bf8 so the project will be bootstrapped with an old unsupported version of tools.

Please update to Node 6 or higher for a better, fully supported experience. ... You are running Node v10.0.0-nightly201803206a958d2bf8. Create React App requires Node >=4 or higher. Please update your version of Node.

This is probably related to the funny way semver treats comparisons with prerelease versions, but I think the scaffolding should still be supported.

iansu commented 6 years ago

This is definitely a bug. We don't necessarily want to encourage running pre-release versions of node but we also shouldn't block people from testing Create React App with them.

Do you happen to know if there's an issue related to this problem in node-semver?

user135711 commented 6 years ago

@iansu I just meant the behavior of pre-releases is odd with inequalities in semantic versioning if that was used here.

nuttt commented 6 years ago

I'm happy to work on this 😃

update: I've tried coerce-ing process.version in createReactApp.js

https://github.com/nuttt/create-react-app/commit/115fcec68f6e34b0b9142bc8a8361965ae9ad3a2#diff-f9867c1e09ced1328f2ccdac4afac4a5R200

It seems that nightly build also break other stuffs in yarn.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.5.1
warning You are using Node "10.0.0-nightly201803278eca6b8d3d" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error react-dev-utils@5.0.0: The engine "node" is incompatible with this module. Expected version ">=6".
salincakli commented 6 years ago

For this setup the yarn npm package must be not installed globally, cra uses npm as fallback then.

(EDIT: I wrote the following before I looked up what semver.coerce does to the string, :1st_place_medal: ;> it is furthermore removing the character 'v' from the start and counts the intermediate dots which is a more safe solution)

I have not tested this workaround but it should be possible to pass the version string check with re-formatting by using "split()" with hyphen-minus "-" and then returning only the first array entry. https://github.com/salincakli/create-react-app/commit/64279c14cd3eb107960ce8d82d659d1db0d65761#diff-f9867c1e09ced1328f2ccdac4afac4a5R555

This way the version strings in the usual format are not modified. Example: 'v8.4.0'.split('-')[0] = 'v8.4.0'

Timer commented 6 years ago

Hi @nuttt, are you willing to submit a PR?

nuttt commented 6 years ago

@Timer Hi, sorry for late reply. I'm kinda busy right now 😢. Please don't wait for me.

albert-olive commented 6 years ago

I'm also having this bug when I'm trying to upgrade CRA to v2.

In my localhost I have:

webpack@2.4.1: The engine "node" is incompatible with this module. Expected version ">=8".

And in my CI:

error eslint@5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0".

Do I have to run yarn --ignore-engines in order to upgrade to v2?

pd: I was using v6.10.3 of node and I upgraded to v8.12.0 in my local and it didn't work.

gaearon commented 6 years ago

@albert-olive I don't think you specified your Node version. So it's a bit difficult to say.

albert-olive commented 6 years ago

I was editing my question before your comment @gaearon :D

gaearon commented 6 years ago

If it doesn't work with 8.x that sounds like a Yarn bug.

albert-olive commented 6 years ago

Ok, I'll try and I'll tell you. Thanks Dan.

albert-olive commented 6 years ago

Hi again @gaearon,

I added the engines in my package.json and now I have the same error but saying that my current project expects that node version.

"engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  }

...

b2b@1.4.5: The engine "node" is incompatible with this module. Expected version ">=10.0.0".

Thanks again.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.