I am trying to containerise Svelte js app inside a docker container and I am getting this error on the log complaining about esbuild in a different platform , I am using M1 mac, I have tried to install esbuild-wasm as what the log suggested and tried npm i esbuild-linux-arm64 as a step in the docker file and tried RUN npm install yarn as the log suggested yarn as it have built-in stuff deal with the platform but it didn't work
my docker file
FROM node:16.10.0
WORKDIR /my-website
COPY package.json .
RUN npm install
# tried this earlier
# RUN npm install yarn
# RUN yarn install
# and this
#RUN npm i esbuild-wasm
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
the error is
rad-website_1 | You installed esbuild on another platform than the one you're currently using.
rad-website_1 | This won't work because esbuild is written with native code and needs to
rad-website_1 | install a platform-specific binary executable.
rad-website_1 |
rad-website_1 | Specifically the "esbuild-darwin-arm64" package is present but this platform
rad-website_1 | needs the "esbuild-linux-arm64" package instead. People often get into this
rad-website_1 | situation by installing esbuild on Windows or macOS and copying "node_modules"
rad-website_1 | into a Docker image that runs Linux, or by copying "node_modules" between
rad-website_1 | Windows and WSL environments.