问题描述
在本地,我的项目使用 ng build --prod 构建得很好,但是如果我使用以下 powershell 脚本在 tfs(团队基础服务器)上设置它,它会失败并出现一些错误.
Locally my project builds fine with ng build --prod but if I set it up on tfs (team foundation server) with the following powershell script it fails with some errors.
ps 脚本:
npm install
npm run ng build --prod
tfs 构建输出:
[1m[33mWARNING in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/sass-loader!./src/scss/style.scss
[1m[33mWARNING in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/sass-loader!./src/scss/style.scss
autoprefixer: D:\a\1\s\src\scss\style.scss:7468:3: 将 transition-property 替换为 transition,因为 Autoprefixer 不支持任何 transition-property 和其他 transition 的情况-*@ ./src/scss/style.scss 4:14-2032017-04-30T07:17:51.9419669Z @ 多 ./~/primeng/resources/themes/bootstrap/theme.css ./~/primeng/resources/primeng.min.css ./~/font-awesome/css/font-awesome.css ./src/scss/style.scss[39m[22m
autoprefixer: D:\a\1\s\src\scss\style.scss:7468:3: Replace transition-property to transition, because Autoprefixer could not support any cases of transition-property and other transition-*@ ./src/scss/style.scss 4:14-2032017-04-30T07:17:51.9419669Z @ multi ./~/primeng/resources/themes/bootstrap/theme.css ./~/primeng/resources/primeng.min.css ./~/font-awesome/css/font-awesome.css ./src/scss/style.scss[39m[22m
[错误] 0% 编译 10% 构建模块 0/1 模块 1 活动多 D:\a\1\s\src\main.ts
[error] 0% compiling 10% building modules 0/1 modules 1 active multi D:\a\1\s\src\main.ts
[error]进程已完成,退出代码为 0,并将 3 个错误写入错误流.
[error]Process completed with exit code 0 and had 3 error(s) written to the error stream.
推荐答案
它现在可以工作了,我删除了 powershell 脚本并在构建过程中添加了单独的任务.
It works now, I removed the powershell script and added seperate tasks in the build process.
- npm install(标准安装)
- npm install -g @angular/cli(命令行)
- ng build --prod(命令行)
根据评论更新:
您也可以使用:npm run ng build -- --prod.这样你就不必安装 angular/cli.
You can also use: npm run ng build -- --prod. This way you don't have to install angular/cli.
这篇关于设置 angular cli 生产构建 tfs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!