Docker question - Sharing the Source Code with a Container

I am doing the docker course and currently, I am doing the 11- Sharing the Source Code with a Container in Working with Containers section.

I did the same thing as Mosh did docker run -d -p 5001:3000 -v $(pwd):/app react-app, however I got sh: react-scripts: not found error and saying my node_modules is missing. So I can not start my container, anyone has this problem?

I am wondering did I do something wrong? why I cannot get the same result as Mosh any help please.

1 Like

Hi Andy,

Check if the node_modules folder exists on pwd folder.

If didn’t work:

  1. Which OS did you installed Docker?
  2. Could you send the container log?

docker logs -f <container_id>

I’ve just solve a problem with this same lesson. In one of many tries I think I got this error, and I am using Windows 10.

I had the same issue, that’s because some packages are missing from the dev machine. Just perform npm install on your dev directory and that should solve it.

1 Like

Hello,

I just encountered the same problem as @andysong666
@leandro.mana, I’m using ubuntu 20.04 and here is my container log :

react-app@0.1.0 start /app
react-scripts start

sh: react-scripts: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! react-app@0.1.0 start: react-scripts start
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the react-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

It worked for me.
Thanks a lot @jeffdess