我正在尝试为生产构建一个Angular 2项目,但发生以下错误(完整输出)
$ ng build --prod
Hash: 1d8a022611a079fc4d52 Time: 15057ms
chunk {0} polyfills.6a841d7989dfdd57acf1.bundle.js (polyfills) 249 kB {5} [initial] [rendered]
chunk {1} styles.872c1a24be4bf9c1223c.bundle.css (styles) 546 bytes {5} [initial] [rendered]
chunk {2} scripts.938daa6986147a5346c9.bundle.js (scripts) 723 kB {5} [initial] [rendered]
chunk {3} main.353b80e799563ca86907.bundle.js (main) 2.59 kB {4} [initial] [rendered]
chunk {4} vendor.da282f8d8f035631cde9.bundle.js (vendor) 875 kB [initial] [rendered]
chunk {5} inline.40400ad5f16398e09e79.bundle.js (inline) 0 bytes [entry] [rendered]
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '<project-root>/src'
@ ./src/main.ts 17:0-74
@ multi ./src/main.ts
我修复了ng lint
中不仅仅是样式问题的所有问题。我知道我需要导出函数而不是&#34; const lambda&#34;和其他常见的AoT事情,但我找不到任何问题,错误没有提示在哪里看。我尝试过--verbose
并没有产生任何有用的信息。
我已经阅读了所有GitHub问题和我能找到的SO问题,但没有人帮助过。
编辑:它似乎与使用绝对路径和bareUrl
typescripts编译器选项有关。
答案 0 :(得分:0)
最终归结为两个 # https://docs.docker.com/engine/examples/mongodb/#creating-a-dockerfile-for-mongodb
# Dockerizing MongoDB: Dockerfile for building MongoDB images
# Based on ubuntu:latest, installs MongoDB following the instructions from:
# http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
# Format: FROM repository[:version]
FROM ubuntu:latest
# Update apt-get sources AND install MongoDB
RUN apt-get update
# Installation:
# Import MongoDB public GPG key AND create a MongoDB list file
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
RUN apt-get install -y --no-install-recommends software-properties-common
RUN apt-get install sudo
# RUN echo "deb http://repo.mongodb.org/apt/ubuntu $(cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2)/mongodb-org/3.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.2.list
RUN echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
RUN apt-get install -y mongodb-org
# MongoDB requires a data directory. Let’s create it as the final step of our installation instructions.
# Create the MongoDB data directory
RUN mkdir -p /data/db
# Expose port 27017 from the container to the host
EXPOSE 27017
# Set usr/bin/mongod as the dockerized entry-point application
ENTRYPOINT ["/usr/bin/mongod"]
问题。首先,我错误地包含了一些仅用于测试的模拟文件。第二,我在tsconfig.json
的{{1}}部分中加入typings.d.ts
,这也打破了构建。