问题描述
我正在为Angular应用创建docker容器。从Dockerfile触发build命令时,它将生成以下错误。但是,如果我生成没有Dockerfile的构建,则可以完美运行。 nodeJS的版本也相同。
ERROR in node_modules/@types/node/base.d.ts(6139,5): error TS2300: Duplicate identifier 'mod'.
src/app.e2e-spec.ts(3,1): error TS2593: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig.
src/app.e2e-spec.ts(6,3): error TS2304: Cannot find name 'beforeEach'.
src/app.e2e-spec.ts(10,3): error TS2593: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig.
src/app.e2e-spec.ts(12,5): error TS2304: Cannot find name 'expect'.
node_modules/@types/requirejs/index.d.ts(38,14): error TS2300: Duplicate identifier 'mod'.
node_modules/@types/requirejs/index.d.ts(422,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'require' must be of type 'NodeRequire',but here has type 'Require'.
node_modules/ng2-select2/ng2-select2.component.d.ts(12,14): error TS2304: Cannot find name 'Select2Options'.
这是我的Dockerfile。
FROM node:12 AS mean
RUN mkdir -p /app
WORKDIR /app
COPY package*.json /app/
RUN rm -rf package-lock.json
RUN npm install
RUN npm install @angular/[email protected] -g
RUN apt-get update
COPY e2e/. /app
COPY src/. /app
COPY angular.json /app
COPY favicon-2.ico /app
COPY schema.js /app
COPY tsconfig.json /app
COPY tslint.json /app
COPY webpack.config.js /app
COPY . .
RUN node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod
# stage 2
FROM nginx:alpine
COPY --from=mean /app/dist/angular-bootstrap-md-app /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 443
请对此提供帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)