expo optimize failing

expo optimize is failing because of “sharp” dependency, even after reinstalling:

NaN/Users/derek/.config/yarn/global/node_modules/sharp-cli/bin/cli.js exited with non-zero code: 1
Output: /Users/derek/.config/yarn/global/node_modules/bindings/bindings.js:119
        throw e;

Error: The module '/Users/derek/.config/yarn/global/node_modules/sharp/build/Release/sharp.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:815:18)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at bindings (/Users/derek/.config/yarn/global/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/Users/derek/.config/yarn/global/node_modules/sharp/lib/constructor.js:10:34)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)

Hey Derek,

Are you using Node 12.x? If so, I think we should have a fix out for this soon. A new version of sharp-cli was released yesterday that resolved some Node 12 build issues. Dropping down to Node 10.x is a viable workaround if you need to keep your workflow uninterrupted.


I am using 12.x - I’ll temporarily drop, thanks for the insight!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.