Better "module not found" message
See original GitHub issueThis is what I see when I forget to install some npm dependencies:
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:
- Created 7 years ago
- Comments:14 (13 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 thedetails
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)
@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.