npm run build error NG8001, NG8002, NG8003 during build docker image

Viewed 121

There are several errors during dockerizing my Angular project.

The point is that there is no error when I run ng serve or npm run build command. I set "strict": false, in tsconfig.json file as well.

I used this command to the dockerize angular project:

docker build -t myProject:latest .

Dockerfile:

#stage 1
FROM node:16.15.0 as node
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build

#stage 2
FROM nginx:alpine
COPY --from=node /app/dist/myProject /usr/share/nginx/html

I can say there is an error in every single component and module in my project, for example:

error NG8001: 'mat-paginator' is not a known element:
error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors
error NG8003: No directive found with exportAs 'ngForm'.
error NG8002: Can't bind to 'pageSizeOptions' since it isn't a known property of 'mat-paginator'.
error NG8002: Can't bind to 'length' since it isn't a known property of 'mat-paginator'.
error NG8002: Can't bind to 'label' since it isn't a known property of 'app-text-input'.

Here is the latest output before the error comes up:

enter image description here

All Versioning:

Angular CLI: 13.3.7
Node: 16.15.0
Package Manager: npm 8.5.5
OS: win32 x64

Angular: 13.3.10
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.7
@angular-devkit/build-angular   13.3.7
@angular-devkit/core            13.3.7
@angular-devkit/schematics      13.3.7
@angular/cdk                    12.2.13
@angular/cli                    13.3.7
@angular/material               12.2.13
@schematics/angular             12.2.17
rxjs                            6.6.7
typescript                      4.6.4
0 Answers
Related