-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
EBUSY on npm install because of rewrite of mounted package.json #28
Comments
You'll need to describe your setup. Host, OS and docker versions, etc. |
Windows 10, Docker is 18.03.1-ce and npm v6.1.0 on top of node alpine image. To reproduce this I think you will need to just mount package.json
and make My main thought that this is related to docker mechanism of mounting single files and npm mechanism of replacing the whole package.json instead of modifying it. So I assume this is will appear on any version of docker since file mounting enabled and any version of npm. Maybe it's related to host and on Linux docker volumes work another way, because npm works in the same way everywhere if I remember right. |
Did you look around for any other windows users having this issue? Are you using Docker for Windows (Hyper-V) or Docker Toolbox (Virtualbox)? |
Yep, they have same problems and just mounting folders, not files. I'm on Hyper-V. So you are using this conf on Linux and do not have any problems or you not have problems with Windows too? |
I'm on macOS and no problems last I checked. I knew it would be an issue on Linux, but figured the SMB sharing on Windows would work around the issue like it does on Mac. Sucks that npm replaces the file. |
Hmm, can you please describe what do you mean by SMB sharing in this case? Even some link with the direction where to dig would be awesome :) |
SMB ("windows file sharing") is the protocol that Windows and the Linux VM running Docker use to share your host code when bind-mounting. |
Hm, seems like in Win it doesn't solve the problem. Maybe it will be great to add comments in compose file for this Windows case? |
I'm can reproduce the same problem on Debian Linux 9 however there is a trick, please see below: Steps to reproduce:
Result:
Result:
|
I have the same problem. I'm mounting |
@d3ce1t Yes I'm exactly on the same opinion. Until there is an option in npm to overwrite package json (instead of creating a copy and renaming it) I believe that this approach won't be working anymore :( |
Meet the same issue. |
Unanswered issue in npm repository npm/npm#16615 UPD: to make it works need to mount folder with package.json file, not directly package.json |
I created the following example to highlight what I can't make it work: I don't have any local As soon as I bootstrap the project with But as soon as I want to add a dependency like As explained in this repo ( If I'm not able to develop locally without having NodeJS installed in the host machine I don't really see the point of using in the It makes sense for staging and production since it will use the packaged app image and run everything without mounting anything and hot-reloading anything. Any hints? Am I missing something also in my assumptions? (@BretFisher moved here the discussion) |
I have updated the upper project code in order to develop with NO NodeJS installed on host machine. It should work. But in the Bret setup the EBUSY problem still exists. |
This repo is just one example of using docker-compose. In my Docker for Node.js course, I cover two Solutions for designing the compose file for local development and students have thought of several other Solutions along the way. I also talk about my two "Solutions" at DockerCon. Those slides start here in my talk. This repo is more aligned with Solution 2 below, but you might consider Solution 1 if the package.json bind-mount issue is a blocker for you. Solution 1:
Solution 2:
|
Isn't there way using yarn's Then you shouldn't need bind mounts on package*.json because all yarn commands should be feasible from project directory directly, shouldn't? Disclaimer: I haven't tested it yet. |
Hi! Thanks for your work of gathering all this stuff in one place!
But how do you managed to make
npm install
work with direct package.json mounts? I get this errors every time:because npm tries to rewrite file from scratch rather than make atomic writes.
The text was updated successfully, but these errors were encountered: