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

very strange error #40

Closed
lqzerogg opened this issue Aug 10, 2016 · 2 comments
Closed

very strange error #40

lqzerogg opened this issue Aug 10, 2016 · 2 comments

Comments

@lqzerogg
Copy link

Recently, I ran into a very strange error with image-webpack-loader
My project were all right util I add some new vendor recently. I have 6 pages in my project and each page has it's style file. If 6 file has this code @import "../../cssBase/index.scss";, image-webpack-loader will have some errors. But if I delete this code in one of my pages, all errors have gone. I wonder why this would happen. Is it because I have too many images?

Here's my code:

//my pages
const PAGES = ['home', 'profile', 'match', 'mall', 'goodsInfo', 'cartList']
//my webpack entries
        let entry = {}
        PAGES.forEach((page) => {
            entry[`js/${page}`] = ['babel-polyfill', 'whatwg-fetch', path.join(PATH.src, `view/pages/${page}/index.js`)]
            entry[`css/${page}`] = path.join(PATH.src, `view/pages/${page}/index.scss`)
            if(DEV) {
                entry[`js/${page}`].push('webpack-hot-middleware/client')
            }
        })
//my image-webpack-loader configuration
                { test: /\.(png|jpg|gif)$/, include: paths,
                    loaders: [
                        'url?limit=2000&name=./img/[name].[hash].[ext]',
                        'image-webpack?{progressive:true, bypassOnDebug:true, optimizationLevel: 3, interlaced: false, pngquant:{quality: "65-90", speed: 4}}'
                    ]
                }
//my pages' style file contain this file, this file defines lots of variables and include some import file
@import "../../cssBase/index.scss";

Here's my errors:
Module build failed: ModuleBuildError: Module build failed: Error: spawn /Users/Zero/projects/livebet-client-code/node_modules/pngquant-bin/vendor/pngquant EAGAIN
at exports._errnoException (util.js:949:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at DependenciesBlock.onModuleBuildFailed (/Users/Zero/projects/livebet-client-code/node_modules/webpack-core/lib/NormalModuleMixin.js:315:19)
at nextLoader (/Users/Zero/projects/livebet-client-code/node_modules/webpack-core/lib/NormalModuleMixin.js:270:31)
at /Users/Zero/projects/livebet-client-code/node_modules/webpack-core/lib/NormalModuleMixin.js:292:15
at context.callback (/Users/Zero/projects/livebet-client-code/node_modules/webpack-core/lib/NormalModuleMixin.js:148:14)
at imagemin.buffer.then.catch.err (/Users/Zero/projects/livebet-client-code/node_modules/image-webpack-loader/index.js:42:9)
at process._tickCallback (internal/process/next_tick.js:103:7)

ERROR in ./feSRC/img/flags/GR_18X12@2x.png
Module build failed: Error: spawn /Users/Zero/projects/livebet-client-code/node_modules/pngquant-bin/vendor/pngquant EAGAIN
at exports._errnoException (util.js:949:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
@ .//css-loader?sourceMap&localIdentName=[path][name]---[local]---[hash:base64:5]!.//postcss-loader!./feSRC/view/pages/profile/index.scss 6:13630-13675

@lqzerogg
Copy link
Author

It seems that too many images will cause this problem. I figure out why my project has this problem.
My project has more than 7 pages, and it has a module that includes almost all of the national flags. At first, each page only had a individual style file. It means that my project would process all of the flags into each style files. That was meaning image-webpack-loader would process more than 1400 images.
And now I extract some common module into a singular file. Now that each page has two style files, the common one and a particular one. And now image-webpack-loader only processes about 200 images, so I do not run into this trouble any more.

@jwdomingo
Copy link

I just ran into the same problem and I'm only trying to load two images from a react-leaflet map dependency.

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