question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Bind Mounts: error Couldn't find a package.json file in "/app"

See original GitHub issue

I was having an issue completing the steps in Starting a Dev-Mode Container.

  1. Run the following command (if you are using PowerShell then use this command):

docker run -dp 3000:3000 ` -w /app -v “$(pwd):/app” ` node:12-alpine ` sh -c “yarn install && yarn run dev”

An image ID would be output in the shell, but examining the container using Docker Desktop revealed the container had exited with the following terminal output:

yarn install v1.22.4 [1/4] Resolving packages… success Already up-to-date. Done in 0.05s. yarn run v1.22.4 error Couldn’t find a package.json file in “/app” info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I had to update the command in step 2 to the following:

docker run -dp 3000:3000 ` -w /app -v “$(pwd):/app” ` node:12-alpine ` sh -c “cd app && yarn install && yarn run dev”

Is this an appropriate work around?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:49
  • Comments:33

github_iconTop GitHub Comments

75reactions
ben-xxcommented, Oct 1, 2020

The tutorial mentions only once early on which directory you should run commands from when starting the tutorial, so it’s easy to miss.

We need to be inside the app directory.

So after unzipping the getting-started tutorial we have something like d:\getting-started\app If running the docker run command from d:\getting-started\ you’ll get the above error.

So cd into d:\getting-started\app and try the command again.

11reactions
iajayprajapati5commented, Mar 31, 2021

Hi @MSoup , I am also new to docker today I faced same issue with windows 10 only,

my working directory is E:\DockerPractice\getting-started\app

so what I did is docker run -dp 3000:3000 -w //app -v "//e/DockerPractice/getting-started/app:/app" node:12-alpine sh -c "yarn install && yarn run dev"

this command works fine for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker Compose couldn't find a package.json file in "/app"
Your volumes: block is replacing the /app directory in the container with something totally different.
Read more >
"Use Docker Compose" in Get started tutorial (solved)
I did several searches of the internet and this forum and finally I found Using Bind Mounts: error Couldn't find a package.json file...
Read more >
error Couldn't find a package.json file in "/app" : r/docker - Reddit
SOLVED Hey, I'm new to docker and doing the getting started introductory stuff. In multi-container apps section i'm trying to run this code ......
Read more >
Working with docker bind mounts and node_modules - burnedikt
The result is the following error when running the app within the container: Node Sass could not find a binding for your current...
Read more >
Introduction to Docker for Javascript Developers (feat Node.js ...
If you find this tutorial helpful, please share it with your friends and colleagues! ... Then add a start script to your package.json...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found