[英]An unhandled exception occurred: Could not find module “@angular-devkit/build-angular” from "/project into a docker
I am trying to got an image in docker on a way I could write docker-compose up --build
and container works.我试图在 docker 中获得一个图像,我可以编写
docker-compose up --build
和容器工作。
But I am getting this error when I run docker-compose up
after building the image:但是当我在构建映像后运行
docker-compose up
时出现此错误:
An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" from "/project
I solved the problem the problem before by adding RUN npm install --save-dev @angular-devkit/build-angular
in the Dockerfile
but then other dependencies did not work.我通过在 Dockerfile 中添加
RUN npm install --save-dev @angular-devkit/build-angular
Dockerfile
了这个问题,但是其他依赖项不起作用。
I think is a problem with the folders in docker but I do not know what I am missing.我认为 docker 中的文件夹有问题,但我不知道我缺少什么。
This is the Dockerfile
:这是
Dockerfile
:
FROM node:12.16.3
# Puerto entorno dev
EXPOSE 4200
# Puerto livereload
EXPOSE 49153
# Puerto Test
EXPOSE 9876
# Puerto e2e
EXPOSE 49152
RUN apt update
# Instalamos angular cli en nuestra imágen
RUN npm install -g @angular/cli@8
RUN mkdir /project
COPY . /project/
WORKDIR /project
RUN npm install --yes
The docker-compose.yml
file: docker-compose.yml
文件:
version: '3.4'
services:
client-angular:
image: algoritmofifo
build: .
command: ng serve --host 0.0.0.0
volumes:
- .:/project
ports:
- 4200:4200
- 49153:49153
- 9876:9876
- 49152:49152
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY package.json /app/package.json
RUN npm install
RUN npm install -g @angular/cli@7.3.9
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.