I'm using docker container and install sharp directly to the container during building image, why i'm came across this error?
win32-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install.
host os: Windows 10 64x
This message suggests that a node_modules directory intended for use within a Linux (Alpine?) container was populated outside the container on the Windows host, which won't work with Node native modules. Remove node_modules and run npm install inside the container.
@againstall you say that you install sharp directly to the container during image build, but it sounds like as lovell says, that you're running npm install outside of the container on your windows host(perhaps you did install sharp in the container during image build but used npm install after on the host?.. don't do that).
@polarathene my guess is that the problem was with the volume mounting, probably i've made mistake while mounting node_modules to the container. dependencies installed correctly inside container, but after mounting was overwritten with the local directory. I'll check it out later
Sounds like the problem has been found but please feel free to re-open with more details if not.
I'm actually having the same issue, running my project inside a container with a mounted volume.
I can see that the npm install inside the docker container install the correct version:
> [email protected] install /app/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.4/libvips-8.7.4-linux-x64.tar.gz
And yet when the container starts I get this error
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Error: 'darwin-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.
at Object.hasVendoredLibvips (/app/node_modules/sharp/lib/libvips.js:61:13)
at Object.<anonymous> (/app/node_modules/sharp/lib/constructor.js:9:22)
at Module._compile (internal/modules/cjs/loader.js:799:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Module.require (internal/modules/cjs/loader.js:705:19)
at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:70:37)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/app/node_modules/sharp/lib/index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:799:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
I also did put the node_modules folder in the .dockerignore file, but my project it still seems to read from my host machine that the docker container
Most helpful comment
@polarathene my guess is that the problem was with the volume mounting, probably i've made mistake while mounting node_modules to the container. dependencies installed correctly inside container, but after mounting was overwritten with the local directory. I'll check it out later