Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Pretty" error rendering fails, hiding the original error #921

Closed
aaronjensen opened this issue Apr 5, 2018 · 8 comments
Closed

"Pretty" error rendering fails, hiding the original error #921

aaronjensen opened this issue Apr 5, 2018 · 8 comments

Comments

@aaronjensen
Copy link
Contributor

Description

I've been occasionally getting an error on our circle ci build that looks like below. It appears that there is an error in the error reporting code which means I can't see what the actual error is. I was able to reproduce it on the server and see what the actual error was, so that's good, but it'd be great if html-webpack-plugin didn't use pretty error rendering (or at least fell back to a straight up console.log if it failed).

In case it helps, I included the actual error below.

Error Message & Stack Trace

(node:133) UnhandledPromiseRejectionWarning: Error: `from` shouldn't be larger than `to`
    at SpecialString.module.exports.SpecialString.cut (/home/circleci/repo/client/node_modules/renderkid/lib/layout/SpecialString.js:108:13)
    at Block.module.exports.Block._writeLine (/home/circleci/repo/client/node_modules/renderkid/lib/layout/Block.js:242:31)
    at Block.module.exports.Block._writeInline (/home/circleci/repo/client/node_modules/renderkid/lib/layout/Block.js:216:14)
    at Block.module.exports.Block._flushBuffer (/home/circleci/repo/client/node_modules/renderkid/lib/layout/Block.js:167:10)
    at Block.module.exports.Block._deactivate (/home/circleci/repo/client/node_modules/renderkid/lib/layout/Block.js:95:10)
    at Block.module.exports.Block.close (/home/circleci/repo/client/node_modules/renderkid/lib/layout/Block.js:130:10)
    at RenderKid.module.exports.RenderKid._renderBlockNode (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:168:18)
    at RenderKid.module.exports.RenderKid._renderNode (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:135:12)
    at RenderKid.module.exports.RenderKid._renderChildrenOf (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:125:12)
    at RenderKid.module.exports.RenderKid._renderBlockNode (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:164:10)
    at RenderKid.module.exports.RenderKid._renderNode (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:135:12)
    at RenderKid.module.exports.RenderKid._renderChildrenOf (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:125:12)
    at RenderKid.module.exports.RenderKid._renderBlockNode (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:164:10)
    at RenderKid.module.exports.RenderKid._renderDom (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:116:10)
    at RenderKid.module.exports.RenderKid.render (/home/circleci/repo/client/node_modules/renderkid/lib/RenderKid.js:66:29)
    at PrettyError.module.exports.PrettyError.render (/home/circleci/repo/client/node_modules/pretty-error/lib/PrettyError.js:347:31)
    at Object.toString (/home/circleci/repo/client/node_modules/html-webpack-plugin/lib/errors.js:20:26)
    at childCompiler.compileTemplate.catch.err (/home/circleci/repo/client/node_modules/html-webpack-plugin/index.js:71:70)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Actual error:

Error: Child compilation failed:
Module build failed: Error: /home/circleci/repo/client/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory

    at Promise.all.then.arr (/home/circleci/repo/client/node_modules/exec-buffer/node_modules/execa/index.js:201:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7):
Error: /home/circleci/repo/client/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory

    at childCompiler.runAsChild (/home/circleci/repo/client/node_modules/html-webpack-plugin/lib/compiler.js:79:16)
    at compile (/home/circleci/repo/client/node_modules/webpack/lib/Compiler.js:222:11)
    at hooks.afterCompile.callAsync.err (/home/circleci/repo/client/node_modules/webpack/lib/Compiler.js:470:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/repo/client/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/home/circleci/repo/client/node_modules/tapable/lib/Hook.js:35:21)
    at compilation.seal.err (/home/circleci/repo/client/node_modules/webpack/lib/Compiler.js:467:30)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/repo/client/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/home/circleci/repo/client/node_modules/tapable/lib/Hook.js:35:21)
    at hooks.optimizeAssets.callAsync.err (/home/circleci/repo/client/node_modules/webpack/lib/Compilation.js:957:35)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/repo/client/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/home/circleci/repo/client/node_modules/tapable/lib/Hook.js:35:21)
    at hooks.optimizeChunkAssets.callAsync.err (/home/circleci/repo/client/node_modules/webpack/lib/Compilation.js:948:32)
    at _err1 (eval at create (/home/circleci/repo/client/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:15:1)
    at /home/circleci/repo/client/node_modules/uglifyjs-webpack-plugin/dist/index.js:262:11
    at _class.runTasks (/home/circleci/repo/client/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:63:9)
    at UglifyJsPlugin.optimizeFn (/home/circleci/repo/client/node_modules/uglifyjs-webpack-plugin/dist/index.js:182:16)
    at _fn0.then._result0 (eval at create (/home/circleci/repo/client/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:11:1)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm, webpack, and html-webpack-plugin. Run the following to get it quickly:

Node.js v8.10.0
linux 4.4.0-116-generic
webpack@4.1.1
html-webpack-plugin@3.1.0
@jantimon
Copy link
Owner

jantimon commented Apr 5, 2018

Thanks for reporting - that sounds quite aweful.
Can you please post a minimal webpack configuration to reproduce such an error?

@aaronjensen
Copy link
Contributor Author

Unfortunately I'm having trouble reproducing it locally. If I replace pngquant with a script that emits the above error it works. It may be environment specific on our CI server.

@jantimon
Copy link
Owner

Any updates on reproduction?

@aaronjensen
Copy link
Contributor Author

Nope, sorry. It could be worth wrapping the call to PrettyError.render in an exception handler and printing the original raw exception just in case. We're not seeing this anymore since we updated our image-webpack-loader dependencies and CI server debian versions.

@jantimon
Copy link
Owner

Okay sounds good - Could you please open a pull request?

aaronjensen added a commit to aaronjensen/html-webpack-plugin that referenced this issue Apr 15, 2018
@aaronjensen
Copy link
Contributor Author

Sure: #925

@jantimon
Copy link
Owner

Cool ty 👍

@lock
Copy link

lock bot commented May 31, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2018
jantimon pushed a commit that referenced this issue Oct 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants