React-native: Cannot find entry file index.android.js in any of the roots

Created on 7 Jan 2016  Â·  17Comments  Â·  Source: facebook/react-native

PC: Windows 7
Node: v4.2.4
Python: 2.7.10
npm: 2.14.12
Proxy: 127.0.0.1:8087
react-native: 0.1.7

When i run the command react-native start,then browse in the chrome with the url: http://localhost:8081/index.android.bundle?platform=android&dev=true

it shows error message as follows:

{
message: "Cannot find entry file index.android.js in any of the roots: ["D:\\workspace\\snowdream\\git\\react_native_helloworld"]",
name: "NotFoundError",
type: "NotFoundError",
status: 404,
errors: [
{ }
]
}
Locked

Most helpful comment

I has the same problem too. fixed founction:
1、react-native start
2、react-native run-android
will fix the problem.

All 17 comments

adb logcat

W/unknown:React( 5229): Could not parse DebugServerException from: {"message":"Cannot find entry file index.android.js in any of the roots: [\"D:\\\\workspace\\\\snowdream\\\\git\\\\react_native_helloworld\"]","name":"NotFoundError","type":"NotFoundError","status":404,"errors":[{}]}
W/unknown:React( 5229): org.json.JSONException: No value for filename
W/unknown:React( 5229):         at org.json.JSONObject.get(JSONObject.java:389)
W/unknown:React( 5229):         at org.json.JSONObject.getString(JSONObject.java:550)
W/unknown:React( 5229):         at com.facebook.react.devsupport.DebugServerException.parse(DebugServerException.java:56)
W/unknown:React( 5229):         at com.facebook.react.devsupport.DevServerHelper$1.onResponse(DevServerHelper.java:187)
W/unknown:React( 5229):         at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:168)
W/unknown:React( 5229):         at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
W/unknown:React( 5229):         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/unknown:React( 5229):         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/unknown:React( 5229):         at java.lang.Thread.run(Thread.java:818)
E/unknown:React( 5229): Unable to download JS bundle
E/unknown:React( 5229): java.io.IOException: Unexpected response code: 404
E/unknown:React( 5229):         at com.facebook.react.devsupport.DevServerHelper$1.onResponse(DevServerHelper.java:191)
E/unknown:React( 5229):         at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:168)
E/unknown:React( 5229):         at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
E/unknown:React( 5229):         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/unknown:React( 5229):         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/unknown:React( 5229):         at java.lang.Thread.run(Thread.java:818)

Hey snowdream, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

I has the same problem when starting the Example project in the react-native master branch,and no other node server running.When i open localost:8081/debug/graph,get this._depGraph.getDebugInfo is not a function.

I has the same problem too.But fixed after I edit the file index.android.js .
I found before i edit index.android.js in file fastfs.js

_getFile(filePath) {
filePath = path.normalize(filePath);
if (!hasOwn.call(this._fastPaths, filePath)) {
this._fastPaths[filePath] = this._getAndAssertRoot(filePath).getFileFromPath(filePath);
}

return this._fastPaths[filePath];

}

“hasOwn.call(this._fastPaths, filePath)” return truebut code “this._fastPaths[filePath]” return undefined。

The problem I was facing was fastfs.js and paths involved had different casing. this._getAndAssertRoot(filePath) throws error if filePath is not found in root. In my case filePath was "c:\projects\myproj..." and this._roots[0] was "C:\projects\myproj". Note drive letter case. So function isDescendant(root, child) returned false. When I changed
return child.startsWith(root);
with

return child.toLowerCase().startsWith(root.toLowerCase());
everything worked.
Note that this is a hack rather than the solution, but let's hope this leads someone on the right track.

When I eject mobile hard disk everything is ok.But i do not know why.

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/cannot-find-entry-file-indexandroidjs-in-any-of-the-roots-

ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub. GitHub issues have voting too, nevertheless
Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.

I has the same problem too. fixed founction:
1、react-native start
2、react-native run-android
will fix the problem.

It's 2017, and this issue still persists. Worst experience as first timer like me. Have been looking for solution, but no real working solution yet. Happens on two computers, two operating systems each (windows and linux), all failed.

Same problem here.
I tried to clean the npm cache, and complete reinstall node_modules. I tried to reinit the RN project.
No effect.

i also assume you have tried:
node node_modules/react-native/local-cli/cli.js start --reset-cache

@stoffern I did, but still not working

@subsub give me some details
Versions ?
OS
Node
NPM
RN
Custom babelrc ?
Default RN repo?

I had the same issue but trying below definitely worked for me:

  1. at the root of the project in terminal - npm start --root .
  2. Open new terminal at the root of the project andreact-native run-android

Make sure the emulator is running. Hope it helps

@stoffern Now it's working.
Here's how. After asking my friend and he also struggles to find out why, who couldn't help to make it work after all. After he gave up, at the end, I then check all the version:
os (windows 10, same),
node (me: 6.11.0, him: 6.10.3),
npm (3.10.10, same).
I find we all use the same version except node js. I use latest node js v6.11.0 while he uses 6.10.3. So I uninstall nodejs, and install version 6.10.3, and try to build new project, and turns out it works.
So for me, node js is the problem. v6.11.0 definitely not working for me.

I had the same problem too, hit below commands:
react-native start
react-native run-android

The this._hasteFS.exists method used in react-native\packager\src\node-haste\index.js does not return correct value. It returns false even though the index.android.js file exist in the path.

Check https://github.com/facebook/react-native/issues/14736

Was this page helpful?
0 / 5 - 0 ratings