You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
somehow reliably tell yarn corresponds to an npm module before calling it
We currently use Yarn if yarn --version exits successfully. We could also check the output of the command. At least the yarn command from a version of Hadoop I installed to test doesn't even recognize the --version and fails. Or we could also use a more specific command (yarn help add?) but the output of --version is easier to assert.
Why catch doesn't catch the error.
This is weird. On my machine, after uninstalling Yarn and installing Hadoop create-react-app uses npm because yarn --version fails:
I think we should check the output of yarn --version and validate that it's a valid semver version greater than or equal to 0.16.1 (the first version that works with CRA). The chances of another executable passing that test should be pretty minimal and this is also similar to the test that react-native CLI uses.
I am developing on Windows 10, just now installed create-react-app and have also just hit this error. I am using nodejs@6.9.2, npm@4.0.3, and create-react-app@1.0.2. The command "yarn --version" returns the following:
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
C:\temp>create-react-app new-react-app
Creating a new React app in C:\temp\new-react-app.
Installing packages. This might take a couple minutes.
Installing react-scripts...
Error: Could not find or load main class add
module.js:471
throw err;
^
Error: Cannot find module 'C:\temp\new-react-app\node_modules\react-scripts\package.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at checkNodeVersion (C:\Users\Bob\AppData\Roaming\nvm\v6.9.2\node_modules\create-react-app\index.js:225:21)
at C:\Users\Bob\AppData\Roaming\nvm\v6.9.2\node_modules\create-react-app\index.js:179:5
at ChildProcess.<anonymous> (C:\Users\Bob\AppData\Roaming\nvm\v6.9.2\node_modules\create-react-app\index.js:165:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at ChildProcess.cp.emit (C:\Users\Bob\AppData\Roaming\nvm\v6.9.2\node_modules\create-react-app\node_modules\cross-spawn\lib\en
oent.js:40:29)
After I removed "C:\apps\hadoop-2.6.0\bin" from my PATH variable, the "create-react-app new-react-app" command completes successfully. This is not ideal as I need to be able to keep Hadoop in my path. We need to find a way for these tools to co-exist.
Activity
gaearon commentedon Dec 12, 2016
Wow, thanks for reporting.
I'm curious if:
yarn
corresponds to an npm module before calling itcatch
doesn't catch the error.fson commentedon Dec 12, 2016
Wow, that's interesting.
We currently use Yarn if
yarn --version
exits successfully. We could also check the output of the command. At least theyarn
command from a version of Hadoop I installed to test doesn't even recognize the--version
and fails. Or we could also use a more specific command (yarn help add
?) but the output of--version
is easier to assert.This is weird. On my machine, after uninstalling Yarn and installing Hadoop

create-react-app
usesnpm
becauseyarn --version
fails:I think we should check the output of
yarn --version
and validate that it's a valid semver version greater than or equal to0.16.1
(the first version that works with CRA). The chances of another executable passing that test should be pretty minimal and this is also similar to the test thatreact-native
CLI uses.gaearon commentedon Dec 12, 2016
@kathyw268 Can you post the output of
create-react-app --version
? Thanks!kathyw268 commentedon Dec 12, 2016
@gaearon
create-react-app version: 1.0.1
gaearon commentedon Dec 12, 2016
Could you try updating to
1.0.2
and try with it instead?I'm curious if changes from #1223 made it better.
Sorry for spending your time on this.
kathyw268 commentedon Dec 13, 2016
Success! Thanks for being so responsive. Keep up the good work.
fson commentedon Dec 13, 2016
Great! Thanks for the confirmation. I'm glad the recent changes to Yarn detection fixed this issue.
bcardi commentedon Dec 14, 2016
I am developing on Windows 10, just now installed create-react-app and have also just hit this error. I am using nodejs@6.9.2, npm@4.0.3, and create-react-app@1.0.2. The command "yarn --version" returns the following:
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
fson commentedon Dec 14, 2016
@bcardi How does it fail for you? Can you post the output of the
create-react-app
command? Thanks!bcardi commentedon Dec 17, 2016
bcardi commentedon Dec 17, 2016
FYI, I also have Hadoop installed and its bin folder is in my PATH variable.
After I removed "C:\apps\hadoop-2.6.0\bin" from my PATH variable, the "create-react-app new-react-app" command completes successfully. This is not ideal as I need to be able to keep Hadoop in my path. We need to find a way for these tools to co-exist.
20 remaining items