strapi-tool-dockerize icon indicating copy to clipboard operation
strapi-tool-dockerize copied to clipboard

When using dockerize with NPM , build fails due to wrong esbuild platform type

Open exotexot opened this issue 3 years ago • 1 comments

Using NPM with dockerize fails es wrong esbuild platform is being referenced.

#13 2.765 Building your admin UI with development configuration... #13 3.728 ℹ Compiling Webpack #13 3.976 HookWebpackError: #13 3.976 You installed esbuild for another platform than the one you're currently using. #13 3.976 This won't work because esbuild is written with native code and needs to #13 3.976 install a platform-specific binary executable. #13 3.976 #13 3.976 Specifically the "esbuild-darwin-64" package is present but this platform #13 3.976 needs the "esbuild-linux-64" package instead. People often get into this #13 3.976 situation by installing esbuild on Windows or macOS and copying "node_modules" #13 3.976 into a Docker image that runs Linux, or by copying "node_modules" between #13 3.976 Windows and WSL environments. #13 3.976 #13 3.976 If you are installing with npm, you can try not copying the "node_modules" #13 3.976 directory when you copy the files over, and running "npm ci" or "npm install" #13 3.976 on the destination platform after the copy. Or you could consider using yarn #13 3.976 instead of npm which has built-in support for installing a package on multiple #13 3.976 platforms simultaneously. #13 3.976 #13 3.976 If you are installing with yarn, you can try listing both this platform and the #13 3.976 other platform in your ".yarnrc.yml" file using the "supportedArchitectures" #13 3.976 feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures #13 3.976 Keep in mind that this means multiple copies of esbuild will be present. #13 3.976 #13 3.976 Another alternative is to use the "esbuild-wasm" package instead, which works #13 3.976 the same way on all platforms. But it comes with a heavy performance cost and #13 3.976 can sometimes be 10x slower than the "esbuild" package, so you may also not #13 3.976 want to do that. #13 3.976 #13 3.976 at makeWebpackError (/opt/app/node_modules/webpack/lib/HookWebpackError.js:48:9) #13 3.976 at /opt/app/node_modules/webpack/lib/Compilation.js:3060:12 #13 3.976 at eval (eval at create (/opt/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), :55:1) #13 3.976 at processTicksAndRejections (node:internal/process/task_queues:96:5) #13 3.976 -- inner error --

exotexot avatar Sep 28 '22 11:09 exotexot

This seems to be an issue with your build environment IF you are using WSL you need to also have build tools etc to make it work. Also make sure you are not binding node_modules

Eventyret avatar Sep 29 '22 12:09 Eventyret