将Angular 5应用程序部署到Heroku时出现问题

维尼修斯·埃斯佩兰萨

我一直在尝试将Angular 5应用程序部署到Heroku中。我已经在其他项目中做到了这一点,但是对于这个项目,可能存在一些依赖问题,我不能做同样的事情。

在本地计算机上,我可以正常运行ng build

另一方面,当Heroku运行此命令(ng build)时,出现以下错误:

-----> Build
remote:        Detected both "build" and "heroku-postbuild" scripts
remote:        Running heroku-postbuild
remote:        
remote:        > [email protected] heroku-postbuild /tmp/build_aa000f62bacba3344bfd7e2865e0bc78
remote:        > ng build
remote:        
remote: internal/modules/cjs/loader.js:775
remote:     throw err;
remote:     ^
remote: 
remote: Error: Cannot find module '@angular-devkit/core'
remote: Require stack:
remote: - /tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/tree/virtual.js
remote: - /tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/tree/filtered.js
remote: - /tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/tree/static.js
remote: - /tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/index.js
remote: - /tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular/cli/utilities/schematics.js
remote: - /tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular/cli/commands/generate.js
remote: - /tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular/cli/lib/cli/index.js
remote: - /tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular/cli/bin/ng
remote:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:677:27)
remote:     at Module.require (internal/modules/cjs/loader.js:830:19)
remote:     at require (internal/modules/cjs/helpers.js:68:18)
remote:     at Object.<anonymous> (/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/tree/virtual.js:10:16)
remote:     at Module._compile (internal/modules/cjs/loader.js:936:30)
remote:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
remote:     at Module.load (internal/modules/cjs/loader.js:790:32)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:703:12)
remote:     at Module.require (internal/modules/cjs/loader.js:830:19) {
remote:   code: 'MODULE_NOT_FOUND',
remote:   requireStack: [
remote:     '/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/tree/virtual.js',
remote:     '/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/tree/filtered.js',
remote:     '/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/tree/static.js',
remote:     '/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular-devkit/schematics/src/index.js',
remote:     '/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular/cli/utilities/schematics.js',
remote:     '/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular/cli/commands/generate.js',
remote:     '/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular/cli/lib/cli/index.js',
remote:     '/tmp/build_aa000f62bacba3344bfd7e2865e0bc78/node_modules/@angular/cli/bin/ng'
remote:   ]
remote: }
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! [email protected] heroku-postbuild: `ng build`
remote: npm ERR! Exit status 1
remote: npm ERR! 
remote: npm ERR! Failed at the [email protected] heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.jo13D/_logs/2020-04-10T21_07_21_257Z-debug.log
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected

我的package.json是以下内容:

{
  "name": "remeli-web",
  "version": "0.0.2",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --host 0.0.0.0 --disable-host-check --port 4242 -w --proxy-config proxy.conf.json",
    "build": "ng build --env prod --prod --aot",
    "build-homolog": "ng build --env homolog --prod --aot",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "heroku-postbuild": "ng build"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.1.0",
    "@angular/common": "^5.1.0",
    "@angular/compiler": "^5.1.0",
    "@angular/core": "^5.1.0",
    "@angular/forms": "^5.1.0",
    "@angular/http": "^5.1.0",
    "@angular/platform-browser": "^5.1.0",
    "@angular/platform-browser-dynamic": "^5.1.0",
    "@angular/router": "^5.1.0",
    "@fortawesome/fontawesome-free": "^5.3.1",
    "@fortawesome/fontawesome-svg-core": "^1.2.9",
    "@fortawesome/free-brands-svg-icons": "^5.6.0",
    "@fortawesome/free-solid-svg-icons": "^5.6.0",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0",
    "@ngx-share/core": "^5.3.1",
    "@types/promise.prototype.finally": "^2.0.2",
    "angular-calendar": "^0.23.3",
    "angular2-notifications": "^1.0.0",
    "bootstrap": "^4.0.0-beta",
    "compass-mixins": "^0.12.10",
    "core-js": "^2.5.3",
    "hammerjs": "^2.0.8",
    "install": "^0.10.2",
    "moment": "^2.19.4",
    "ng2-dnd": "^5.0.2",
    "ng2-img-cropper": "^0.9.0",
    "ng2-trim-directive": "^2.1.0",
    "ng2-truncate": "^1.3.11",
    "ngx-bootstrap": "^2.0.0",
    "ngx-infinite-scroll": "^0.8.2",
    "ngx-slick": "^0.1.3",
    "npm": "^5.6.0",
    "pretty-checkbox": "^3.0.3",
    "promise.prototype.finally": "^3.1.0",
    "rxjs": "^5.5.5",
    "ts-md5": "^1.2.2",
    "webpack": "^3.10.0",
    "zone.js": "^0.8.18"
  },
  "devDependencies": {
    "@angular/cli": "1.6.0",
    "@angular/compiler-cli": "^5.1.0",
    "@angular/language-service": "^5.1.0",
    "@types/jasmine": "~2.8.2",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.0.58",
    "codelyzer": "~4.0.2",
    "file-loader": "^1.1.5",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.3.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.13.1",
    "protractor": "~5.2.1",
    "ts-node": "~4.0.1",
    "tslint": "~5.8.0",
    "typescript": "^2.4.2"
  },
  "engines": {
    "node": "12.9.0",
    "npm": "6.13.0"
  }
}

我也尝试添加依赖项(即使我不需要添加依赖项也可以在本地构建项目)。

我跑步npm install @angular-devkit/core并得到"@angular-devkit/core": "^9.1.1"

我再次推送到heroku,错误更改为:

remote:        > ng build
remote:        
remote:        
remote:        @angular/[email protected] requires typescript@'>=2.4.2 <2.5.0' but 2.9.2 was found instead.
remote:        Using this version can result in undefined behaviour and difficult to debug problems.
remote:        
remote:        Please run the following command to install a compatible version of TypeScript.
remote:        
remote:            npm install typescript@'>=2.4.2 <2.5.0'
remote:        
remote:        To disable this warning run "ng set warnings.typescriptMismatch=false".
remote:        
remote:        Date: 2020-04-10T21:19:58.382Z
remote:        Hash: 668a7a095131daade445
remote:        Time: 27626ms
remote:        chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
remote:        chunk {main} main.bundle.js, main.bundle.js.map (main) 889 kB [initial] [rendered]
remote:        chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 399 kB [initial] [rendered]
remote:        chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 277 kB [initial] [rendered]
remote:        chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 9.45 MB [initial] [rendered]
remote: 
remote: ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/assets/sass/app.scss
remote: Module build failed: 
remote:   @return mix($color-base, $color, $level * $theme-color-interval);
remote:          ^
remote:       Argument `$color-2` of `mix($color-1, $color-2, $weight: 50%)` must be a color
remote:       in /tmp/build_b1b8a012dd41e35e651d945fbbda4881/node_modules/bootstrap/scss/_functions.scss (line 96, column 11)
remote: Error: 
remote:   @return mix($color-base, $color, $level * $theme-color-interval);
remote:          ^
remote:       Argument `$color-2` of `mix($color-1, $color-2, $weight: 50%)` must be a color
remote:       in /tmp/build_b1b8a012dd41e35e651d945fbbda4881/node_modules/bootstrap/scss/_functions.scss (line 96, column 11)
remote:     at options.error (/tmp/build_b1b8a012dd41e35e651d945fbbda4881/node_modules/node-sass/lib/index.js:291:26)
remote:  @ ./src/assets/sass/app.scss 4:14-206
remote:  @ multi ./node_modules/ng2-dnd/bundles/style.css ./src/styles.scss ./src/assets/sass/app.scss ./src/assets/slick.css ./src/assets/slick-theme.css ./src/assets/calendar.css ./src/assets/notification.css
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! [email protected] heroku-postbuild: `ng build`
remote: npm ERR! Exit status 1
remote: npm ERR! 
remote: npm ERR! Failed at the [email protected] heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.uRy2g/_logs/2020-04-10T21_19_58_443Z-debug.log
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected

有人尝试部署到heroku时会遇到类似的错误吗?

维尼修斯·埃斯佩兰萨

好吧,我找不到lib依赖项的问题,因此在本地构建应用程序后,我不得不将其应用程序部署为静态html。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

运行`foreman start` /将Django应用程序部署到Heroku时出现问题

来自分类Dev

将应用程序部署到Google App Engine时出现问题

来自分类Dev

将 Laravel 应用程序部署到 AWS Elastic bean 时出现问题

来自分类Dev

将Rails应用程序部署到Heroku时出现“无法加载此类文件”错误

来自分类Dev

将Spring Boot应用程序部署到Heroku时出现SQLSyntaxErrorException

来自分类Dev

将网站部署到Heroku时出现应用程序错误

来自分类Dev

将Rails应用程序部署到Heroku时出现“无法加载此类文件”错误

来自分类Dev

将 Django 应用程序部署到 heroku 时出现 `collectstatic` 错误

来自分类Dev

将Rails应用程序部署到heroku时出了点问题

来自分类Dev

将应用程序部署到heroku时预编译资产问题

来自分类Dev

将Flask应用程序部署到Heroku时出错

来自分类Dev

将 angular-universal 应用程序部署到 heroku

来自分类Dev

在将 Angular 应用程序部署到 heroku 和运行 ng serve 时出错?

来自分类Dev

我在将 Angular 应用程序部署到 github 页面时遇到问题

来自分类Dev

部署Spring Boot + Angular应用程序时出现问题

来自分类Dev

使用git push将Django应用程序部署到heroku时出现无法识别的错误

来自分类Dev

将 Google App Engine 应用部署到 GCP 时出现问题

来自分类Dev

使用dotnet-buildpack将ASP.NET 5应用程序部署到Heroku时出错

来自分类Dev

将应用程序升级到CodeIgniter 3后出现问题

来自分类Dev

部署:将Angular 2 / Node.js应用程序部署到Heroku

来自分类Dev

将Flask应用程序部署到heroku会导致create_app()出现500错误

来自分类Dev

将Mern应用程序部署到heroku之后的路由问题

来自分类Dev

我将MERN应用程序部署到Heroku出了什么问题?

来自分类Dev

如何解决此问题以将Rails应用程序部署到Heroku?

来自分类Dev

为Angular应用程序创建样式化的复选框指令时出现问题

来自分类Dev

将文件类型与应用程序关联时出现问题

来自分类Dev

将mysql数据库与基于Java的Web应用程序链接时出现问题

来自分类Dev

将文件类型与应用程序关联时出现问题

来自分类Dev

将 React 应用程序导出为包含 SVG 图片的 npm 模块时出现问题

Related 相关文章

  1. 1

    运行`foreman start` /将Django应用程序部署到Heroku时出现问题

  2. 2

    将应用程序部署到Google App Engine时出现问题

  3. 3

    将 Laravel 应用程序部署到 AWS Elastic bean 时出现问题

  4. 4

    将Rails应用程序部署到Heroku时出现“无法加载此类文件”错误

  5. 5

    将Spring Boot应用程序部署到Heroku时出现SQLSyntaxErrorException

  6. 6

    将网站部署到Heroku时出现应用程序错误

  7. 7

    将Rails应用程序部署到Heroku时出现“无法加载此类文件”错误

  8. 8

    将 Django 应用程序部署到 heroku 时出现 `collectstatic` 错误

  9. 9

    将Rails应用程序部署到heroku时出了点问题

  10. 10

    将应用程序部署到heroku时预编译资产问题

  11. 11

    将Flask应用程序部署到Heroku时出错

  12. 12

    将 angular-universal 应用程序部署到 heroku

  13. 13

    在将 Angular 应用程序部署到 heroku 和运行 ng serve 时出错?

  14. 14

    我在将 Angular 应用程序部署到 github 页面时遇到问题

  15. 15

    部署Spring Boot + Angular应用程序时出现问题

  16. 16

    使用git push将Django应用程序部署到heroku时出现无法识别的错误

  17. 17

    将 Google App Engine 应用部署到 GCP 时出现问题

  18. 18

    使用dotnet-buildpack将ASP.NET 5应用程序部署到Heroku时出错

  19. 19

    将应用程序升级到CodeIgniter 3后出现问题

  20. 20

    部署:将Angular 2 / Node.js应用程序部署到Heroku

  21. 21

    将Flask应用程序部署到heroku会导致create_app()出现500错误

  22. 22

    将Mern应用程序部署到heroku之后的路由问题

  23. 23

    我将MERN应用程序部署到Heroku出了什么问题?

  24. 24

    如何解决此问题以将Rails应用程序部署到Heroku?

  25. 25

    为Angular应用程序创建样式化的复选框指令时出现问题

  26. 26

    将文件类型与应用程序关联时出现问题

  27. 27

    将mysql数据库与基于Java的Web应用程序链接时出现问题

  28. 28

    将文件类型与应用程序关联时出现问题

  29. 29

    将 React 应用程序导出为包含 SVG 图片的 npm 模块时出现问题

热门标签

归档