linuxmusl-x64平台上无法使用linux-x64二进制文件错误 [英] linux-x64 binaries cannot be used on the linuxmusl-x64 platform error

查看:119
本文介绍了linuxmusl-x64平台上无法使用linux-x64二进制文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用package.json在Node.js项目的docker映像上安装 Sharp 软件包以进行图像压缩.当我创建容器时,对于尖锐的包装,会出现以下错误:

I'm installing the Sharp package for image compression on the docker image for a Nodejs project with package.json. When I create the container I get the following error regarding to the sharp package:

/app/node_modules/sharp/lib/libvips.js:67 
throw new Error(`'${vendorPlatformId}' binaries cannot be used on the '${currentPlatformId}' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.`);
 ^ Error: 'linux-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.
at Object.hasVendoredLibvips (/app/node_modules/sharp/lib/libvips.js:67:13)
at Object.<anonymous> (/app/node_modules/sharp/lib/constructor.js:8:22)
at Module._compile (module.js:577:32) 
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32) 
at tryModuleLoad (module.js:453:12) 
at Function.Module._load (module.js:445:3) 
at Module.require (module.js:504:17) 
at require (internal/module.js:20:19) 
at Object.<anonymous> (/app/node_modules/sharp/lib/index.js:3:15)'.

我已经删除了整个node_module目录,并在目录中重新运行了 npm install 命令以重新安装所有包,还重建了docker镜像,但是仍然出现错误.

I have removed the whole node_module directory and reran the npm install command in the directory to reinstall all pack and also rebuilt the docker image but I'm still getting the error.

对于如何解决此问题的任何建议,我们深表感谢.

Any recommendations on how to fix this issue is appreciated.

推荐答案

我在Docker上遇到了同样的错误.问题是我忘了包含一个 .dockerignore 文件,而我的 node_modules 被复制到了容器中.

I faced the same error with Docker. The problem was that I forgot to include a .dockerignore file and my node_modules were being copied into the container.

尝试在项目的根目录(Dockerfile的旁边)中创建一个 .dockerignore 文件,例如:

Try creating a .dockerignore file in the root of your project (next to your Dockerfile) with e.g.:

node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore

这篇关于linuxmusl-x64平台上无法使用linux-x64二进制文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆