首页 > 解决方案 > 构建命令失败 - Netlify

问题描述

我一直在做一个有角度的项目,我一直想在 Netlify 平台上部署它,但是在部署我的项目时它显示错误。当我检查日志时,它显示build.command失败,但是当我ng build在终端中运行该命令时,它工作正常。

我正在分享 Netlify 部署日志:

11:30:10 AM: ERROR in ./node_modules/angular-bootstrap-md/assets/scss/mdb.scss (./node_modules/css-loader/dist/cjs.js??ref--13-1!./node_modules/postcss-loader/src??embedded!./node_modules/resolve-url-loader??ref--13-3!./node_modules/sass-loader/dist/cjs.js??ref--13-4!./node_modules/angular-bootstrap-md/assets/scss/mdb.scss)
11:30:10 AM: Module build failed (from ./node_modules/postcss-loader/src/index.js):
11:30:10 AM: Error: Failed to find '@angular/cdk/overlay-prebuilt.css'
11:30:10 AM:   in [
11:30:10 AM:     /opt/build/repo/node_modules/angular-bootstrap-md/assets/scss
11:30:10 AM:   ]
11:30:10 AM:     at /opt/build/repo/node_modules/postcss-import/lib/resolve-id.js:35:13
11:30:10 AM:     at async Promise.all (index 0)
11:30:10 AM: ERROR in The target entry-point "angular-bootstrap-md" has missing dependencies:
11:30:10 AM:  - @angular/cdk/a11y
11:30:10 AM: npm ERR! code ELIFECYCLE
11:30:10 AM: npm ERR! errno 1
11:30:10 AM: npm ERR! argon-dashboard-angular@1.2.0 build: `ng build`
11:30:10 AM: npm ERR! Exit status 1
11:30:10 AM: npm ERR!
11:30:10 AM: npm ERR! Failed at the argon-dashboard-angular@1.2.0 build script.
11:30:10 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:30:10 AM: npm ERR! A complete log of this run can be found in:
11:30:10 AM: npm ERR!     /opt/buildhome/.npm/_logs/2021-05-15T06_00_10_702Z-debug.log
11:30:10 AM: ​
11:30:10 AM: ────────────────────────────────────────────────────────────────
11:30:10 AM:   "build.command" failed                                        
11:30:10 AM: ────────────────────────────────────────────────────────────────
11:30:10 AM: ​
11:30:10 AM:   Error message
11:30:10 AM:   Command failed with exit code 1: npm run build
11:30:10 AM: ​
11:30:10 AM:   Error location
11:30:10 AM:   In Build command from Netlify app:
11:30:10 AM:   npm run build
11:30:10 AM: ​
11:30:10 AM:   Resolved config
11:30:10 AM:   build:
11:30:10 AM:     command: npm run build
11:30:10 AM:     commandOrigin: ui
11:30:10 AM:     publish: /opt/build/repo/dist
11:30:11 AM: Caching artifacts
11:30:11 AM: Started saving node modules
11:30:11 AM: Finished saving node modules
11:30:11 AM: Started saving build plugins
11:30:11 AM: Finished saving build plugins
11:30:11 AM: Started saving pip cache
11:30:11 AM: Finished saving pip cache
11:30:11 AM: Started saving emacs cask dependencies
11:30:11 AM: Finished saving emacs cask dependencies
11:30:11 AM: Started saving maven dependencies
11:30:11 AM: Finished saving maven dependencies
11:30:11 AM: Started saving boot dependencies
11:30:11 AM: Finished saving boot dependencies
11:30:11 AM: Started saving rust rustup cache
11:30:11 AM: Finished saving rust rustup cache
11:30:11 AM: Started saving go dependencies
11:30:11 AM: Finished saving go dependencies
11:30:13 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:30:13 AM: Creating deploy upload records
11:30:13 AM: Failing build: Failed to build site
11:30:13 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
11:30:13 AM: Finished processing build request in 1m24.409154949s

标签: angularnpmbuildnetlifymdbootstrap

解决方案


推荐阅读