question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XXX binaries cannot be used on the 'linux-x64' platform.

See original GitHub issue

Hi, I was using sharp for an AWS Lambda function (v0.18.0) and it was working very well. I want to update to the last version (v0.21), however, I’m now having an issue:

  • ‘darwin-x64’ binaries cannot be used on the ‘linux-x64’ platform. (npm install done on mac)
  • ‘win-x64’ binaries cannot be used on the ‘linux-x64’ platform. (npm install done on win10) These errors

It looks like there is a problem with libvips:

"stackTrace": [
    "Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:9:22)",
    "Module._compile (module.js:570:32)",
    "Object.Module._extensions..js (module.js:579:10)",
    "Module.load (module.js:487:32)",
    "tryModuleLoad (module.js:446:12)",
    "Function.Module._load (module.js:438:3)",
    "Module.require (module.js:497:17)",
    "require (internal/module.js:20:19)",
    "Object.<anonymous> (/var/task/node_modules/sharp/lib/index.js:3:15)"
  ]

CloudWatch logs:

module initialization error: Error
    at Object.hasVendoredLibvips (/var/task/node_modules/sharp/lib/libvips.js:61:13)
    at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:9:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/var/task/node_modules/sharp/lib/index.js:3:15)

I don’t really understand your documentation Do I need to install Docker, create a linux container and then do npm install?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
lovellcommented, Nov 16, 2018

Commit dcd6830 adds a Docker-less method to the docs.

rm -rf node_modules/sharp
npm install --arch=x64 --platform=linux --target=8.10.0 sharp

http://sharp.pixelplumbing.com/en/latest/install/#aws-lambda

1reaction
lovellcommented, Nov 15, 2018

Hello, AWS Lambda uses 64-bit Linux and you’ll need to ensure npm install is run on the same platform to populate node_modules with the correct files.

The Docker command shown at http://sharp.pixelplumbing.com/en/stable/install/#aws-lambda allows you to run npm install inside a Linux container that closely matches the AWS Lambda runtime.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node modules - Error:'darwin-x64' binaries cannot be used on ...
The answer here resolved it for me: Run brew reinstall vips . Then delete the node_modules folder and install all dependencies again (with...
Read more >
Building a project with luntimeIdentifiers = "linux-x64" result in ...
I would expect that building a Linux project grom GUI would result in a non-exe file that is Linux compatible but that's not...
Read more >
OpenJDK Build README
When the normal defaults fail or components cannot be found, the various ALT_* variables (alternates) can be used to help the makefiles locate...
Read more >
When Things Go Wrong — PyArmor 7.6.0 documentation
This is not PyArmor's error, just Python can not find it. ... Because the obfuscated scripts include binary library, it's platform dependent, and...
Read more >
How to Update node.JS to the Latest Version - HotFrameworks
Node.js is a free, cross-platform, open-source JavaScript runtime environment ... x.x-linux-x64.tar.xz — (where x.x.x is the version of the binary file).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found