Yus*_*suf 26 npm docker dockerfile docker-compose svelte
我正在尝试在 docker 容器内容器化 Svelte js 应用程序,并且在日志中收到此错误,抱怨不同平台中的 esbuild,我使用的是 M1 mac,我尝试esbuild-wasm
按照日志建议进行安装,并尝试npm i esbuild-linux-arm64
作为一个步骤在 docker 文件中并尝试RUN npm install yarn
按照日志建议使用纱线,因为它有内置的东西处理平台,但它不起作用我的 docker 文件
FROM node:16.10.0
WORKDIR /my-website
COPY package.json .
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
Run Code Online (Sandbox Code Playgroud)
错误是
You installed esbuild on another platform than the one you're currently using.
This won't work because esbuild is written with native code and needs to
install a platform-specific binary executable.
Specifically the "esbuild-darwin-arm64" package is present but this platform
needs the "esbuild-linux-arm64" package instead. People often get into this
situation by installing esbuild on Windows or macOS and copying "node_modules"
into a Docker image that runs Linux, or by copying "node_modules" between
Windows and WSL environments.
Run Code Online (Sandbox Code Playgroud)
小智 31
您已从node_modules
本地环境复制到容器。在本地,您有 darwin-arm64 架构的软件包,但在容器内部,它是一个 Linux 系统,需要 linux-arm64 的软件包。
为了避免此类错误,您不应将 node_modules 复制到容器中。
您所需要做的就是将 node_modules 添加到.dockerignore
文件中
归档时间: |
|
查看次数: |
31737 次 |
最近记录: |