question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better "module not found" message

See original GitHub issue

This is what I see when I forget to install some npm dependencies:

screen shot 2016-08-08 at 16 34 37

wat

This is overwhelming and unnecessary. We should have simple messages, like:

These dependencies were not found in node_modules:

  * redux
  * react-redux

Did you forget to run npm install --save for them?

I’m not sure what to do with local file missing errors (i.e. when you import a non-existing file in src). We should probably group them separately but also in a less intimidating way.

I don’t personally plan to work on this so any help is welcome!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

4reactions
geowarincommented, Aug 8, 2016

Hi @gaearon.

If you change this line to var json = stats.toJson({}, true);, you’ll get a much shorter error output. It is what webpack normally displays on errors (ie, when you don’t parse the errors yourself) and it doesn’t include the details field. See here.

This is a short term measure before somebody actually dives into webpack internals to do exactly what you suggested. (I’m working on geowarin/tarec#16 and as promised I will contribute back when it’s ready but if somebody wants to tackle it in the meantine, it would be interesting)

1reaction
fsoncommented, Sep 11, 2016

@mareksuscak Thanks for the tip, didn’t know about this setting before. However, I think it could increase the confusion in some cases, because we would basically be creating a hidden file that makes npm behave differently from the default. People might not notice it or understand what it does, only npm would seem to behave differently from time to time. That’s why I think a simple message showing how to use npm install --save, as suggested originally, would be a better option.

This project also aims to avoid adding configuration and flags as much as possible, so generating a .npmrc file would not fit well in this philosophy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

module-not-found - Next.js
A module not found error can occur for many different reasons: The module you're trying to import is not installed in your dependencies;...
Read more >
Have a JavaScript Module Not Found Error ... - Airbrake Blog
If you're seeing a "module not found: error: can't resolve," in your Javascript code, here's an explanation as to why and how to...
Read more >
Better errors on module not found · Issue #443 - GitHub
When a module is not found ERR_MODULE_NOT_FOUND is thrown. The error is thrown in module_wrap.cc within Maybe FinalizeResolution.
Read more >
ModuleNotFoundError: no module named Python Error [Fixed]
As the name implies, this error occurs when you're trying to access or use a module that cannot be found. In the case...
Read more >
javascript - Module not found can't resolve - Stack Overflow
app/index.js Module not found: Error: Can't resolve './app/test.js'. I've tried changing the file path to a relative one with no luck and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found