AWS Beanstalk:ng build --aot --prod错误

时间:2019-05-21 15:57:20

标签: node.js angular amazon-web-services amazon-elastic-beanstalk

我正在尝试使用eb cli在AWS beantalk上部署节点/表达式+角度应用程序。

运行eb deploy时,我在AWS实例(t2.small)上收到此错误:

  Could not find module "@angular-devkit/build-angular" from "/tmp/deployment/application".
  Error: Could not find module "@angular-devkit/build-angular" from "/tmp/deployment/application".
      at Object.resolve (/tmp/deployment/application/node_modules/@angular/cli/node_modules/@angular-devkit/core/node/resolve.js:141:11)
      at Observable.rxjs_1.Observable [as _subscribe] (/tmp/deployment/application/node_modules/@angular/cli/node_modules/@angular-devkit/architect/src/architect-legacy.js:153:40)
      at Observable._trySubscribe (/tmp/deployment/application/node_modules/@angular/cli/node_modules/rxjs/internal/Observable.js:44:25)
      at Observable.subscribe (/tmp/deployment/application/node_modules/@angular/cli/node_modules/rxjs/internal/Observable.js:30:22)
      at /tmp/deployment/application/node_modules/@angular/cli/node_modules/rxjs/internal/Observable.js:99:19
      at new Promise (<anonymous>)
      at Observable.toPromise (/tmp/deployment/application/node_modules/@angular/cli/node_modules/rxjs/internal/Observable.js:97:16)
      at BuildCommand.initialize (/tmp/deployment/application/node_modules/@angular/cli/models/architect-command.js:67:96)
      at process._tickCallback (internal/process/next_tick.js:68:7)
      at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! app@0.0.0 postinstall: `ng build --aot --prod`
  npm ERR! Exit status 1
  npm ERR!
  npm ERR! Failed at the app@0.0.0 postinstall script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我不明白为什么需要@angular-devkit/build-angular,因为它应该是我的package.json中的devDependency。

此外,在Heroku上进行上载/ npm安装/ ng构建工作...

我在做什么错了?

1 个答案:

答案 0 :(得分:0)

检查“ @ angular-devkit / build-angular”是否已在package.json的devDependencies中添加了此依赖关系,如果不只是在带有标志的命令下面

  

npm install @ angular-devkit / build-angular --save-dev