turbo: cannot copy to non-directory DOCKER MACOS
What version of Turborepo are you using?
1.4.7
What package manager are you using / does the bug impact?
pnpm
What operating system are you using?
Mac
Describe the Bug
On Mac, I tested on windows and this run perfectly, with this repo: https://github.com/yovanoc/turbo-test
if we run pnpm build:docker this give:
Expected Behavior
Should work on Mac too
To Reproduce
Just clone the repo and build with docker
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 17
- Comments: 29 (8 by maintainers)
Try add
**/node_modulesto.dockerignoreHad the same issue. It was fixed by adding
**/node_modulesto.dockerignore, like @John-Hejzlar said.I had this same issue & noticed that after running the prune command (even outside of Docker), each package in
out/fullhad anode_moduleswith the expected file structure, but with no actual source code. I think everything that pnpm symlinked is just missing in the full pruned output, but the fact that thenode_modulesdirectory structure is there causes an issue? I was able to work around this by removing allnode_modulesfromout/full– this is my full working Dockerfile:I’m not actually sure what the intention is with the prune command though – ie:, why does the
with-dockerexample copy over just the pruned package jsons and lockfile before running pnpm install, and THEN copy over the full source code? Wouldn’t the pruned lockfile & package.json just be installing everything already inout/fullanyway? Why not just copy overout/fulland then run install (I guess it’s to do with Docker layer cacheing where the source code changes more frequently than the dependencies)?Update to add full source code: https://github.com/redbadger/monorepo-examples/tree/turborepo-monobuild
I am having this issue as well. Also on a Mac (M1). Was not yet able to test on a Windows machine but will do. This is my (very similar) Dockerfile:
And the error I get:
I already tested all mentioned fix ideas but nothing worked for me.
https://github.com/vercel/turbo/discussions/3346#discussioncomment-5703415
Yeah it’s the symlinks
(must include root
node_modules- talking aboutdocker-composedev here)encountered the same with WSL2 Ubuntu.
**/node_modulesfixed it for me@xencodes I ran into the same thing, I think the example build assumes you’re using standalone output https://nextjs.org/docs/advanced-features/output-file-tracing#automatically-copying-traced-files
Lifesaver!
If docker can’t copy ‘out’ dir of turbo during build and if you use M1 you can solve with this environment for docker
DOCKER_DEFAULT_PLATFORM=linux/amd64I had this issue too with just
node_modules, but**/node_moduleswill ignore all node_modules.Same here on Windows 11 > WSL2 (Ubuntu 22.10)
Wondering if it’s related to symlinks; what if you add node_modules to the .dockerignore file to avoid its including it as part of the build context? Especially when you say it works on Windows I think it could be symlinks related
@tknickman I’m tagging you in on this one; can reproduce, but seems quite strange to me.