Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Error In Docker with Subdirectory #1170

Closed
JonathanHopeDMRC opened this issue Apr 20, 2021 · 2 comments
Closed

Build Error In Docker with Subdirectory #1170

JonathanHopeDMRC opened this issue Apr 20, 2021 · 2 comments

Comments

@JonathanHopeDMRC
Copy link

This is an edge case for sure.

I noticed this building a Vue project using Vite in a docker image. If the source tree is a layer below the docker file the following error will occur:

#12 0.836 > docker-error@0.0.0 build
 #12 0.836 > vue-tsc --noEmit && vite build
 #12 0.836
 #12 12.94 failed to load config from /src/subdir/vite.config.ts
 #12 12.94 error during build:
 #12 12.94 Error: The service was stopped
 #12 12.94     at /src/subdir/node_modules/esbuild/lib/main.js:1014:31
 #12 12.94     at /src/subdir/node_modules/esbuild/lib/main.js:568:9
 #12 12.94     at Socket.afterClose (/src/subdir/node_modules/esbuild/lib/main.js:546:7)
 #12 12.94     at Socket.emit (node:events:381:22)
 #12 12.94     at endReadableNT (node:internal/streams/readable:1307:12)
 #12 12.94     at processTicksAndRejections (node:internal/process/task_queues:81:21)
 #12 12.95 npm notice
 #12 12.95 npm notice New minor version of npm available! 7.7.6 -> 7.10.0
 #12 12.95 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.10.0>
 #12 12.95 npm notice Run `npm install -g npm@7.10.0` to update!
 #12 12.95 npm notice

This can fixed adding RUN node node_modules/esbuild/install.js before the build line in the Dockerfile.

Fully reproducible example is here: https://github.com/JonathanHopeDMRC/docker-error. Just run docker build ..

Thanks,
Jonathan

@evanw
Copy link
Owner

evanw commented Apr 20, 2021

Sorry, I don't use Docker myself. Can you say what the problem is? Is the executable not being installed on the file system with npm install? Or is it that the executable is present but for the wrong architecture somehow?

One thing that can prevent the executable from being installed is if the ignore-scripts npm setting is set to true, since then the install script isn't run. That could be something to check.

Another thing to check would be the logs before this point since if esbuild failed to install correctly, the failure should show up in the installation log.

@JonathanHopeDMRC
Copy link
Author

After getting some sleep I looked at this clear eyed.

There was a bug in the glob expression of the .dockerignore that was pulling in the node_modules directory from Windows into the Linux image. I assume it was also pulling in the windows binary, which also explains why running the install script again fixed it.

This isn't a bug on your side of things, sorry for the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants