角7应用程序部署NG构建不明白--target或--environment(Angular 7 ap

2019-10-28 12:15发布

我部署一个角度应用Netlify。 这个应用程序已经部署了很多次,没有出现过问题。 最近,同时加入了新的功能,我升级的应用程序从角5到7,升级和许多依赖。 现在构建与漂亮的最少信息失败。

在Netlify,我使用build命令是: ng build --target=development --environment=staging用于开发和ng build --target=production --environment=prod进行督促。

在Netlify日志是:

3:54:11 PM: Fetching cached dependencies
3:54:11 PM: Starting to download cache of 99.4MB
3:54:12 PM: Finished downloading cache in 773.818516ms
3:54:12 PM: Starting to extract cache
3:54:17 PM: Finished extracting cache in 4.66127562s
3:54:17 PM: Finished fetching cache in 5.479273794s
3:54:17 PM: Starting to prepare the repo for build
3:54:17 PM: Preparing Git Reference pull/102/head
3:54:18 PM: Starting build script
3:54:18 PM: Installing dependencies
3:54:19 PM: Started restoring cached node version
3:54:21 PM: Finished restoring cached node version
3:54:21 PM: v8.15.1 is already installed.
3:54:22 PM: Now using node v8.15.1 (npm v6.4.1)
3:54:23 PM: Attempting ruby version 2.3.6, read from environment
3:54:24 PM: Using ruby version 2.3.6
3:54:24 PM: Using PHP version 5.6
3:54:24 PM: Started restoring cached node modules
3:54:24 PM: Finished restoring cached node modules
3:54:24 PM: Installing NPM modules using NPM version 6.4.1
3:55:17 PM: > node-sass@4.11.0 install /opt/build/repo/node_modules/node-sass
3:55:17 PM: > node scripts/install.js
3:55:17 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-57_binding.node
3:55:18 PM: Download complete
3:55:18 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-57/binding.node
3:55:18 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.11.0/linux-x64-57_binding.node
3:55:19 PM: > node-sass@4.11.0 postinstall /opt/build/repo/node_modules/node-sass
3:55:19 PM: > node scripts/build.js
3:55:19 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-57/binding.node
3:55:19 PM: Testing binary
3:55:19 PM: Binary is fine
3:55:22 PM: npm WARN
3:55:22 PM: optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/webpack-dev-server/node_modules/fsevents):
3:55:22 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:55:22 PM: npm WARN optional
3:55:22 PM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
3:55:22 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:55:22 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/@angular/compiler-cli/node_modules/fsevents):
3:55:22 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:55:22 PM: npm
3:55:22 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/@angular-devkit/core/node_modules/fsevents):
3:55:22 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:55:22 PM: added 561 packages from 247 contributors, removed 635 packages, updated 323 packages and audited 36240 packages in 57.022s
3:55:22 PM: found 0 vulnerabilities
3:55:23 PM: NPM modules installed
3:55:23 PM: Started restoring cached go cache
3:55:23 PM: Finished restoring cached go cache
3:55:23 PM: unset GOOS;
3:55:23 PM: unset GOARCH;
3:55:23 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
3:55:23 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
3:55:23 PM: go version >&2;
3:55:23 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
3:55:23 PM: go version go1.10 linux/amd64
3:55:23 PM: Installing missing commands
3:55:23 PM: Verify run directory
3:55:23 PM: Executing user command: ng build --target=development --environment=staging
3:55:25 PM: Unknown option: '--target'
3:55:25 PM: Unknown option: '--environment'
3:55:25 PM: Caching artifacts
3:55:25 PM: Started saving node modules
3:55:25 PM: Finished saving node modules
3:55:25 PM: Started saving pip cache
3:55:25 PM: Finished saving pip cache
3:55:25 PM: Started saving emacs cask dependencies
3:55:25 PM: Finished saving emacs cask dependencies
3:55:25 PM: Started saving maven dependencies
3:55:25 PM: Finished saving maven dependencies
3:55:25 PM: Started saving boot dependencies
3:55:25 PM: Finished saving boot dependencies
3:55:25 PM: Started saving go dependencies
3:55:25 PM: Finished saving go dependencies
3:55:25 PM: Error running command: Build script returned non-zero exit code: 1
3:55:25 PM: Failing build: Failed to build site
3:55:29 PM: Finished processing build request in 1m20.618386048s
3:55:30 PM: Shutting down logging, 0 messages pending

我注意到--target=--environment=不被处理。 在过去的成功部署日志,这些选项的工作就好了。 所以我假设部署问题与这一点。

任何人都可以请提供一些这方面的指导?

谢谢。

Answer 1:

检查文档为最新的角CLI命令纳克构建命令。

这两个选项是丢失:

3:55:25 PM: Unknown option: '--target'
3:55:25 PM: Unknown option: '--environment'

对于--target您可以指定--prod=true

和用于--environment --configuration=production (来自angular.json文件)



Answer 2:

我相信你可以使用下面的参数,而不是

dev的:

--configuration=development
--prod=false

为督促:

--configuration=production 
--prod=true

您还可以了解所有可以使用的参数在这里



文章来源: Angular 7 app deployment ng build does not understand --target or --environment