5

I tried ignoring the node_modules but still is not working for me ,even after ignoring the node_modules im still facing the same error

yaml file:

version: '3.5'

services:
    angular-docker:
        hostname: localhost
        container_name: angular-docker
        build: ./angular-doc
        volumes:
          - './angular-doc:/usr/src/app/'
        ports:
          - '4200:4200'

docker file:

FROM node:10.12.0

RUN mkdir usr/src/app

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install -g @angular/cli@latest

COPY . .

EXPOSE 4200

CMD ng serve --host 0.0.0.0
Muhammed Albarmavi
  • 23,240
  • 8
  • 66
  • 91
Venkat
  • 51
  • 1
  • 2
  • 1. Run command npm install in your project folder if it's not work then 2. npm install --save-dev @angular-devkit/build-angular if it's not work then 3. npm i --only=dev if it's also not work then remove node_modules folder from your project make anew project copy node_modules folder and past it in your project then again run npm install hope its work for you. – Syed Kashif Apr 03 '19 at 12:59
  • You are missing `npm install` from your `Dockerfile` after the line where you copy your `package.json` – Castro Roy Apr 04 '19 at 00:21

1 Answers1

1

You need to install @angular-devkit/build-angular package as dev dependency in your angular project

npm install --save-dev @angular-devkit/build-angular

Updated!

you have forget to add RUN npm install in the docker file

FROM node:10.12.0
RUN mkdir usr/src/app
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
RUN npm install -g @angular/cli@latest
COPY . .
EXPOSE 4200
CMD ng serve --host 0.0.0.0
Muhammed Albarmavi
  • 23,240
  • 8
  • 66
  • 91