-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-native init fails in Windows 10 #21029
Comments
It looks like you are using an older version of React Native. Please update to the latest release, v0.56 and verify if the issue still exists. The ":rewind:Old Version" label will be removed automatically once you edit your original post with the results of running |
I have reinstalled node to the latest version, uninstall react-native-cli and installed it again with a global flag After that, I tried to run It throws an error and it still the same:
after doing
In this case no mention of the packages. I did an npm install inside the project, but the information running the same instruction is the same. The AwesomeProject project's package.js content is the following:
So I understand is the last react-native version. Checking the other projects I created before the reinstalation, I can see that their package.js was basically the same, only diference that the react-native installed was 0.56.0, I created several projects to test |
This should be fixed in 0.57. Stable is right around the corner if you're willing to wait, otherwise you can use |
Thank you for your reply. I tried to run this time in the last line of the yarn-error.log says:
|
I'm currently re-checking stable versions that are working on Windows, so I might have found some things: For me working versions are
@hramos for information, when using latest 0.57.2 on Windows I'm hitting issue #21617 ... EDIT: but was able to get it running via |
This comment has been minimized.
This comment has been minimized.
Actually no, the problem has not been solved yet. I am using expo because it does work. I tried to install last react-native version again last December from scratch, and the same problems arise. Expo is ok for my current project, but it might become a bit short for some projects I plan to start in the near future, so I would be interested to be able to develop properly with react-native. |
What about React Native 0.57.8 or 0.58.0-rc.2? |
I just experienced the same issue, but running on linux mint. error An unexpected error occurred: "/home/talles/.cache/yarn/v4/npm-jest-cli-24.1.0-f7cc98995f36e7210cce3cbb12974cbf60940843/node_modules/jest-cli/.yarn-metadata.json: Unexpected end of JSON input". info If you think this is a bug, please open a bug report with the information provided in "/home/tallles/Projects/tests/compara/yarn-error.log". Error: Command failed: yarn add jest babel-core@^7.0.0-bridge.0 babel-jest metro-react-native-babel-preset [email protected] --dev --exact ----x---- Here is the yarn error log: |
Using RN 0.57.8 or 0.58.0-rc.2 I get: error An unexpected error occurred: "/home/talles/.cache/yarn/v4/npm-p-locate-3.0.0-322d69a05c0264b25997d9f40cd8a891ab0064a4/node_modules/p-locate/.yarn-metadata.json: Unexpected end of JSON input". Error: Command failed: yarn add jest babel-jest metro-react-native-babel-preset [email protected] --dev --exact |
I use version 0.58.5 and I also have this issue, expo is working but it's not optimal. P.S. |
Running 'yarn cache clean' solved for me. |
This seems like an environment issue (with Yarn or Android Studio or Node), there's likely nothing we can do more about it. I'm gonna close it, because it seems like there's not many users encountering this. |
|
Does it still happen for you? We usually get quite a lot of upvotes for the issues that happen for more users, so I assume this is just environmental issue, as solutions vary per user |
It always happened to me when working with react-native init. I tried everything. But as the system did work with expo I ended moving to it and to forget to use pure react-native. over this last months I have been doing a lot of changes and updates in node, npm, react-native, expo and android studio. In order to test it for this comment I tried to do run react-native init test It also failed to finish the init. error message:
I might do more tests with it today if I have a bit of time. |
We're working on a new init command for 0.60, feel free to try it: https://github.com/react-native-community/cli/blob/master/docs/init.md Here's sample template: https://github.com/Esemesek/react-native-new-template so you can use it like this for now: npx @react-native-community/cli init ProjectName --template react-native-new-template |
This error happens because of some conflict between yarn and npm. I took off yarn and everything worked |
Why is this closed? There is no definitive answer and it is happening to me in Windows 10 too. |
Environment
React Native Environment Info:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-7740X CPU @ 4.30GHz
Memory: 8.38 GB / 15.93 GB
Binaries:
npm: 6.2.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 2.2.0.0 AI-145.3360264
[skip envinfo]
Description
I develop with Windows. I started a new react-native project after updating react-native, using react-native init myApp. However, it fails before ending the the initialization of the project. The message it leaves is:
when checking C:\proyects\myapp\yarn-error.log" its two last lines said:
If I try to do a
npm install
inside of the project's folder and when it is finished I execute
react-native run-android
it gives the following error (I assume that it is becuse it was not properly initialized):
Before the update, I could use react-native init whitout any problem. I have been trying fixes and alternatives, like
react-native init {proj_name} --version [email protected]
but the same error arises. The only way I could create a react-native project by now is via "create-react-native-app", but it limits me because I cannot install native modules.
Reproducible Demo
react-native init myApp
The text was updated successfully, but these errors were encountered: