title: Docker Volume: ENOENT: no such file or directory, open '/app/package.json'
body: <p>I'm using Docker using Docker Toolbox because of I have Windows Home. I made a React application using:</p>
  
  <pre><code>npx create-react-app frontend
  </code></pre>
  
  <p>Thus I made a "Dokerfile.dev" file in which I say doicker to use base image node alpine version, setting working directory "/app", to copy "package.json" that needs to install node "run npm install", and then I say to copy the other files. I put also the command to be enable when I start that container:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>FROM node:alpine
  
  WORKDIR '/app'
  
  COPY package.json .
  RUN npm install
  COPY . .
  
  CMD ["npm","run","start"]</code></pre>
  </div>
  </div>
  </p>
  
  <p>And seems work, because of if I build:</p>
  
  <pre><code>docker build -f Dockerfile.dev .
  </code></pre>
  
  <p>and run it mapping container port to local port (3000):</p>
  
  <pre><code>docker run -it -p 3000:3000 [containerID]
  </code></pre>
  
  <p>it works on <a href="http://192.168.99.100:3000" rel="nofollow noreferrer">http://192.168.99.100:3000</a>, react page working.</p>
  
  <p>After that, I wanna try to run using volume. Actually I delete node_modules dependency from "app" folder, because of npm install it double. This I put it like a placeholder. Instead, I map the Present Working Directory (pwd) with "/app":</p>
  
  <pre><code>docker ruyn -it -p 3000:3000 -v /app/node_modules -v /c/Program\ Files/Docker\ Toolbox/frontend:/app -e CHOKIDAR_USEPOLLING=true a631964d87b2
  </code></pre>
  
  <p>(my pwd contains whitespaces, thus I have to use "\ " isntead of "". "a631964d87b2" is my container id)</p>
  
  <p>The result is:</p>
  
  <pre><code>npm ERR! code ENOENT
  npm ERR! syscall open
  npm ERR! path /app/package.json
  npm ERR! errno -2
  npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json'
  npm ERR! enoent This is related to npm not being able to find a file.
  npm ERR! enoent
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /root/.npm/_logs/2020-05-23T20_10_26_143Z-debug.log
  </code></pre>
  
  <p>Why it works without Volume, instead using volume it says that it doesn't found /app/package.json? That's impossible because of in Dockerfile.dev I say:</p>
  
  <pre><code>COPY package.json .
  </code></pre>
  
  <p>thus to copy package.json to the current working directory which is "/app".</p>
  
  <p><a href="https://i.stack.imgur.com/ox7sQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ox7sQ.png" alt="enter image description here"></a></p>
  
  <p>--- UPDATE</p>
  
  <p>Actually it works if I move project inside c:/Users/username</p>
  
  <p>and I text this:</p>
  
  <pre><code>docker run -it -p 3000:3000 -v /app/node_modules -v $(pwd):/app -e CHOKIDAR_USEPOLLING=true a631964d87b2  
  </code></pre>
  
  <p>That's because $(pwd) puts my Present Working Directory, and in that case it doesn't have whitespaces inside it. How I can put my plan working directory with namespaces?</p>
  
  <p>--- UPDATE 2</p>
  
  <p>problem are not whitespaces: I tried to modify c:/Users/username/frontend in c:/Users/username/abc\ frontend</p>
  
  <p>and it still works. It seems that project must be in users and not in program files
  ?</p>