Running on Windows - no such file or directory, open '/usr/src/app/package.json'
See original GitHub issueThanks a lot Kumar for your tutorial.
I am fairly new to Docker and encounter some issues to browse the website.
I am running docker on my windows 10 Home with Docker tools.
When I execute docker-compose, I got the following error.
remid@LAPTOP-MINGW64 /c/users/remid/dockerized (master)
$ docker-compose up
Starting dockerized_nextjs_1 ... done Attaching to dockerized_nextjs_1
nextjs_1 | npm ERR! code ENOENT
nextjs_1 | npm ERR! syscall open
nextjs_1 | npm ERR! path /usr/src/app/package.json
nextjs_1 | npm ERR! errno -2
nextjs_1 | npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'
nextjs_1 | npm ERR! enoent This is related to npm not being able to find a file.
nextjs_1 | npm ERR! enoent
nextjs_1 |
nextjs_1 | npm ERR! A complete log of this run can be found in:
nextjs_1 | npm ERR! /root/.npm/_logs/2020-03-29T23_25_25_944Z-debug.log
dockerized_nextjs_1 exited with code 254
I have also tried to build the image with docker build with no error:
docker build . project
Step 10/10 : CMD "npm" "run" "dev"
---> Running in 9adcae1ef952
Removing intermediate container 9adcae1ef952
---> ec652f219f51
Successfully built ec652f219f51
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.```
It runs well, I can curl -I http://localhost:3000 with success from the container.
remid@MINGW64 /c/users/remid/dockerized/packages/landingpage (master)
$ docker run ec652f219f51
> with-typescript@1.0.0 dev /usr/src/app
> next
[ wait ] starting the development server ...
[ info ] waiting on http://localhost:3000 ...
> Using "webpackDevMiddleware" config function defined in next.config.js.
However, when trying to map the ports, I got the following error:
$ docker run ec652f219f51 -p 3001:3000
[eval]:1
3001:3000
^
SyntaxError: Unexpected token ':'
at new Script (vm.js:88:7)
at createScript (vm.js:263:10)
at Object.runInThisContext (vm.js:311:10)
at Object.<anonymous> ([eval]-wrapper:10:26)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at evalScript (internal/process/execution.js:94:25)
at internal/main/eval_string.js:23:3
Thanks for your help.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
no such file or directory, open 'C:\Users\Nuwanst\package. ...
It creates a package.json file in your folder. Then run,. C:\Users\Nuwanst\Documents\NodeJS\3.chat>npm install socket.
Read more >Running on Windows - no such file or directory, open '/usr/ ...
Thanks a lot Kumar for your tutorial. I am fairly new to Docker and encounter some issues to browse the website. I am...
Read more >Resolve npm WARN saveError ENOENT no such file or ...
To resolve the ENOENT warning message, you need to add a package.json file in the directory where you run the npm install command....
Read more >Getting no such file package.json when running npm install
I am running Docker on Windows 10 and when I run docker-compose up ... ENOENT: no such file or directory, open '/var/www/package.json' npm ......
Read more >no such file or directory, open '/package.json' : r/docker
I've got the following Dockerfile for a React app and I'm running tests ... ENOENT: no such file or directory, open '/package.json' npm...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You probably have to run docker in a VM to use it on Windows 10 Home - OS built on a fat layer of slippery 💩 So forgetting to mount your folder will cause that
docker-compose
error (it happens to me from time to time). Hope it helps (you or someone else), awesome repo Kumar 🔥To be honest, I am not sure about being able to “change the content of the container dynamically”.
But I know that without volumes, live development will not be possible. It will work only in production then.