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

GZIP fallback #48

Open
krystian50 opened this issue Jan 8, 2020 · 5 comments
Open

GZIP fallback #48

krystian50 opened this issue Jan 8, 2020 · 5 comments

Comments

@krystian50
Copy link

Hi,

I'm getting an error
ERROR (node:1) [ZOPFLI_COMPAT] MISSING_MODULE: Module "node-zopfli-es" was unavailable Zopfli compression unavailable; will fall back to gzip.

Any tips?

The package is added through
"optionalDependencies": { "iltorb": "~2.0.0", "node-zopfli-es": "~1.0.3" },

@krystian50 krystian50 reopened this Jan 8, 2020
@kriscarle
Copy link

@krystian50 check for error messages from npm install node-zopfli-es likely you are missing a prerequisite, it needs python, make, gcc, g++ etc. depending on the platform, see the notes at https://github.com/jaeh/node-zopfli-es

Since it is an "optional" dependency NPM will skip over it if there is an error so a full npm install will still complete.

@H-Gomez
Copy link

H-Gomez commented Feb 20, 2020

@krystian50 were you able to resolve this warning as we are getting it also.
Installed zopfli@1.0.3 directly with Yarn, no problems there.

On building the project I get a similar error:

warning  in ./node_modules/node-zopfli-es/lib/zopfli.js
Critical dependency: the request of a dependency is an expression
(node:10881) [ZOPFLI_COMPAT] MISSING_MODULE: Module "node-zopfli-es" was unavailable
Zopfli compression unavailable; will fall back to gzip.

@kriscarle
Copy link

@H-Gomez @krystian50 any chance you are using Docker? or developing on a different platform and copying your node_modules? I just got this error on a new project because I forgot to add the .dockerignore ignoring node_modules and it was overwriting the native linux build with the files from my Mac.

You can get a better error message by running node -p "require('node-zopfli-es');" In my case I saw zopfli.node: Exec format error

@H-Gomez
Copy link

H-Gomez commented Feb 24, 2020

@kriscarle No docker is being used on the local development environment.
The platform is Mac OSX (10.14) on Node 10.13 and I've removed the node modules and done a fresh yarn to get all the packages installed again with no resolution.

When running the above command in the project root it returns the Zopli class indicating that it's able to find the package source correctly.

node -p "require('node-zopfli-es');"
{ [Function: Zopfli]
  createGzip: [Function],
  createZlib: [Function],
  createDeflate: [Function],
  compress: [Function],
  gzip: [Function],
  zlib: [Function],
  deflate: [Function],
  gzipSync: [Function],
  zlibSync: [Function],
  deflateSync: [Function] }

I can manually edit the zopli-compat.js inside of node_modules/shrink-ray-current/ to log out the error in the catch statement which gives me:

 warning  in ./node_modules/node-zopfli-es/lib/zopfli.js
(node:31489) [MODULE_NOT_FOUND] Error: Cannot find module './binding/zopfli.node'

This to me is confusing as I can see the zopfli.node file exists in node_modules/node-zopfli-es/lib/binding/.
Not entirely sure what else to try here.

@kriscarle
Copy link

@H-Gomez Possibly something odd on your machine like a permissions issue? I'd recommend setting up a very simple hello world express app, then add shrink-ray-current to that and see if this happens in the simplest test case. If so, you could try upgrading NodeJS (10.13 is from October 2018) or use nvm or Docker to test different environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants