社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  docker

带有angular和nginx的Dockerfile在构建阶段失败

bass • 3 年前 • 1378 次点击  

我正在尝试使用angular和nginx为我的项目构建docker映像,但在构建阶段尝试装载映像时出现以下错误(安装似乎可以正常工作):

#11 103.1 Error: src/app/models/index.ts:5:28 - error TS2307: Cannot find module './inputField' or its corresponding type declarations.
#11 103.1
#11 103.1 5 export { InputField } from './inputField';
#11 103.1                              ~~~~~~~~~~~~~~
#11 103.1
#11 103.1
#11 103.1
#11 103.1 npm ERR! code ELIFECYCLE
#11 103.1 npm ERR! errno 1
#11 103.2 npm ERR! myproject@11.0.0 build: `ng build --build-optimizer --output-hashing=none`
#11 103.2 npm ERR! Exit status 1
#11 103.2 npm ERR!
#11 103.2 npm ERR! Failed at the myproject@11.0.0 build script.
#11 103.2 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#11 103.2
#11 103.2 npm ERR! A complete log of this run can be found in:
#11 103.2 npm ERR!     /root/.npm/_logs/2021-07-17T10_12_55_066Z-debug.log
------
executor failed running [/bin/sh -c npm run build]: exit code: 1

我的dockerfile:

# Angular image
FROM node:latest as build

WORKDIR /app
COPY . .
RUN npm install 
RUN npm run build

# Nginx image
FROM nginx:latest

COPY --from=build /dist/angular/ /usr/share/nginx/html/

EXPOSE 80

我做了npm审计修复来解决几个问题,并且删除了node_modules文件夹、缓存和包锁。json,并再次安装,但这些似乎都没有帮助。

提前谢谢。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/130586
 
1378 次点击  
文章 [ 2 ]  |  最新文章 3 年前