Skip to content
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

Docker run cannot find package json #38

Open
gyi123 opened this issue Jan 18, 2022 · 1 comment
Open

Docker run cannot find package json #38

gyi123 opened this issue Jan 18, 2022 · 1 comment

Comments

@gyi123
Copy link

gyi123 commented Jan 18, 2022

Hi, I was able to run yarn web:start from CMD. However when I try to run this in Docker. I got package.json not found error.
Here is the docker file:

FROM node:16.13.0-alpine

set working directory

WORKDIR /
COPY ["yarn.lock", "package.json", "./"]
RUN yarn reset:unix
RUN yarn

add app

COPY . ./

start app

CMD ["yarn", "web:start"]

After successful docker build, I try to run in docker desktop:
docker run -p:3000:3000 myimage
I got this error:
yarn run v1.22.15
$ yarn workspace @my-app/web start
$ craco start
/node_modules/find-root/index.js:19
throw new Error('package.json not found in path')
^

Error: package.json not found in path
at findRoot (/node_modules/find-root/index.js:19:11)
at findRoot (/node_modules/find-root/index.js:28:10)
at findRoot (/node_modules/find-root/index.js:28:10)
at findRoot (/node_modules/find-root/index.js:28:10)
at findRoot (/node_modules/find-root/index.js:28:10)

Any idea on this?
Thanks for the help

@gyi123
Copy link
Author

gyi123 commented Jan 18, 2022

I think I solved it. My docker file is wrong. need to use WORKDIR /repo then COPY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant