Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Add help suggestion on webpack failure #837

Merged
merged 1 commit into from
Nov 4, 2019

Conversation

ashleymichal
Copy link
Contributor

Fixes #428 by including a suggestion to re-run npm install if webpack exits with an error.

@ashleymichal ashleymichal added changelog - feature webpack Issues that involve the `webpack` bundler labels Nov 4, 2019
@ashleymichal ashleymichal added this to the 1.6.0 milestone Nov 4, 2019
@@ -122,7 +122,9 @@ fn write_wranglerjs_output(
) -> Result<(), failure::Error> {
if output.has_errors() {
message::user_error(output.get_errors().as_str());
failure::bail!("Webpack returned an error");
failure::bail!(
"Webpack returned an error. Try re-running npm install, or yarn check --verify-tree."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will running yarn check --verify-tree create a yarn.lock file? i'd hesitate to recommend using yarn when wrangler uses npm

Copy link
Contributor

@EverlastingBugstopper EverlastingBugstopper Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd just add

"You may be able to resolve this issue by running npm install"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah wasn't sure bout the yarn thing, snagged it from the original issue discussion to see how people reacted. i think that's a good text.

Copy link
Contributor

@EverlastingBugstopper EverlastingBugstopper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay :)

@ashleymichal ashleymichal merged commit 639b7f1 into master Nov 4, 2019
@ashleymichal ashleymichal deleted the alewis/warn-node-modules branch November 4, 2019 22:36
@EverlastingBugstopper
Copy link
Contributor

webpack builds can fail for a lot of reasons. the biggest one is probably not the node_modules issue, but using a package that is incompatible with target: webworker. i wonder if it would be more useful to catch a webpack failure the first time, run npm install, and try rebuilding. If that doesn't work, a better error message would be "this is probably not an issue with wrangler, check to make sure any dependencies are compatible with target: webworker or something like that.

i can open an issue for this if we think it's a good idea cc @ashleymichal

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
webpack Issues that involve the `webpack` bundler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggest re-building node_modules on failed builds where appropriate
3 participants