compression-webpack-plugin: node-zopfli not found eventhough it is installed

/usr/src/app/node_modules/compression-webpack-plugin/index.js:20
				throw new Error("node-zopfli not found");
				^

Error: node-zopfli not found
    at new CompressionPlugin (/usr/src/app/node_modules/compression-webpack-plugin/index.js:20:11)
    at getPluginsConfig (/usr/src/app/webpack.config.js:262:5)
    at Object.<anonymous> (/usr/src/app/webpack.config.js:335:12)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)```

So the require in compression-webpack-plugin/index.js fails…

yarn list | grep node-zopfli
warning digitransit-ui@0.0.1: License should be a valid SPDX license expression
│  ├─ node-zopfli@^2.0.0
├─ node-zopfli@2.0.2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Hmm, I’m trying to run it inside fresh docker container and getting these error. Anyway, thank you It’s strange, but locally with NODE_ENV=production everything is working. So something is missing in docker container

I managed to fix it via npm rebuild

You tell me, you created the loose dependency.