E
E
EVOSandru62022-01-12 11:05:46
Docker
EVOSandru6, 2022-01-12 11:05:46

Why is package.json ignored when running Vue from a docker container?

Hey guys, why isn't Vue running in a docker container ?

docker run -it -d --name project_name -p 3001:8080 -v /home/username/PhpstormProjects/project_name/cabinet:/app username/project_name


Dockerfile :

FROM node:17.3-alpine
ARG APP_DIR=/app
ARG LOCAL_APP_PATH=cabinet
RUN mkdir -p ${APP_DIR}
WORKDIR ${APP_DIR}
COPY ${LOCAL_APP_PATH}/package*.json ./
RUN ls -al
RUN npm i;
EXPOSE 8080
CMD npm run serve


This snippet shows when building that package.json is present

Step 7/10 : RUN ls -al
---> Running in d9897f0ce6fa
total 492
drwxr-xr-x 1 root root 4096 Jan 12 07:42 .
drwxr-xr-x 1 root root 4096 Jan 12 07:42 ..
-rw-rw-r-- 1 root root 487553 Jan 12 07:42 package-lock.json
-rw-rw-r-- 1 root root 1397 Dec 22 12:25 pm package.json Gives

docker ps -a

back:

d57e7227eb10 username/project_name "docker-entrypoint.s…" 3 minutes ago Exited (254) 3 minutes ago project_name

I type in:

docker logs d57e7227eb10

I get:

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/2022-01-12T07_47_35_850Z-debug-0.log


At the same time, the installation inside proceeds during the build and the build completes without errors:

Step 8/11 : RUN npm i;
---> Running in 8d33e5110d59
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question