react-native start report: Error: UNKNOWN: unknown error, open …\\.babel.json

淺唱寂寞╮ 提交于 2019-12-01 05:21:22

I have run into this as well and debugged it as far as I could right now. The error arises from some race condition:

  • during the build, babel-register writes a cache to ~/.babel.json, on every tick
  • since the write is synchronous, the race condition cannot arise within a single node thread
  • since node is single-threaded by design, this must be on account of some parallel execution in Java, triggering several parallel node threads

I have no idea why this doesn't happen to everybody or why this only happens after having used react native for some time...

This will need to be fixed in React Native, probably in coordination with babel-register... I will post this into the related GitHub issue as well.

Try deleting .babel.json, generate a new one and grant read permission to that file.

You have a babel.json file at C:\Users\Me that is invalid. Fix that or remove that. This was not created by React Native and is not needed unless you want to set some global babel settings for every project on your machine.

https://github.com/facebook/react-native/issues/11803

  1. Delete .babel.json
  2. react-native run-android (re-generates .babel.json)
  3. open C:\Users\yourUserName\ in Windows Explorer (not IE)
  4. right click on .babel.json > Properties
  5. Security tab > Advanced > Change Permissions... > Add...
  6. Enter the object name to select, type Everyone, click OK
  7. Permissions window, tick "Allow Full Control", click OK
  8. click OK
  9. react-native run-android (works now)

My node.js's version was 7.5.0.

I updated it to 7.10.0 yesterday and the problem solved.

Try this line in git bush

chmod 777 .babel.json

The problem maybe that this file is read-only.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!