Skip to content

Provide more descriptive error message when source file is not found #9

@gaearon

Description

@gaearon
Collaborator

I required wrong file by mistake and got this message:

screen shot 2015-01-30 at 23 56 23

The actual message was obscured in Xcode console:

Error: 
 stack: 
ModuleError@http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:105:23
require@http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:202:28
http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:28141:33
require@http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:243:30
http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:27651:26
require@http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:243:30
http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:946:27
require@http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:243:30
applyWithGuard@http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:871:25
require@http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:194:39
global code@http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle:28295:9
 URL: http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle
 line: 202
 message: Requiring unknown module "./test/actions/RepoActionCreators". It may not be loaded yet. Did you forget to run arc build?"

It would be nice to display the actual error.

Activity

gaearon

gaearon commented on Jan 30, 2015

@gaearon
CollaboratorAuthor

It looks like this message replaces the original message very quickly.

nick

nick commented on Jan 30, 2015

@nick

I found this too. I ended up commenting out these lines as a short term fix:

https://github.com/facebook/react-native/blob/master/Libraries/Bundler/Bundler.js#L49-L52

vjeux

vjeux commented on Jan 30, 2015

@vjeux
Contributor
amasad

amasad commented on Jan 31, 2015

@amasad
Contributor

@gaearon in this case what module where you requiring?

amasad

amasad commented on Jan 31, 2015

@amasad
Contributor

ok, it looks like you were requiring RepoActionCreators. Did that module ever exist and then was deleted?

The packager should definitely return an error and no code. But it also seems to be a bug that the error message has been replaced with a less useful one. cc @frantic

gaearon

gaearon commented on Jan 31, 2015

@gaearon
CollaboratorAuthor

ok, it looks like you were requiring RepoActionCreators. Did that module ever exist and then was deleted?

No, I mistyped the filename. When I fixed it, the error went away.
It's just unfortunate that the real error is always quickly replaced with a vague one.

In fact if you mistype a filename and keep pressing Cmd+R really really fast, that'll give you time to read the first actual error on the screen (before it gets replaced by the vague one).

joeyyang

joeyyang commented on Feb 1, 2015

@joeyyang

Replacing one error message with another is also giving me issues -- I have an npm module that's failing to load and having all the error messages persist would be very helpful in attempting to debug. Let me know what other information I can provide!

frantic

frantic commented on Mar 27, 2015

@frantic
Contributor

@nicklockwood fixed this a while ago

added a commit that references this issue on Aug 5, 2015

10 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @nick@frantic@vjeux@amasad@gaearon

      Issue actions

        Provide more descriptive error message when source file is not found · Issue #9 · facebook/react-native