Сбой сборки по героку для Angular шаблона CoreUI - PullRequest
0 голосов
/ 10 февраля 2020

Я не могу развернуть свой проект angular 8. Я использовал шаблон CodeUI angular, и сборка не удалась при развертывании Heroku. То же самое работает на localhost, но не может сделать сборку на Heroku.

Версии, которые я использую:

  • Angular CLI: 8.3.6
  • Узел: 10.16.0
  • Angular: 8.2.8

Ошибка ниже:

Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild

HireCommit@2.5.2 heroku-postbuild /tmp/build_434f7be8a26abfc4235d95846f4eafd0
g build --aot --prod


Date: 2020-02-10T11:18:59.393Z
Hash: 753b3b69ed4e240fe2ea
Time: 52490ms
chunk {0} runtime.741402d1d47331ce975c.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main.4af9b61479361f268d39.js (main) 128 bytes [initial] [rendered]
ERROR in node_modules/@coreui/angular/lib/sidebar/app-sidebar.component.d.ts(13,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@coreui/angular/lib/sidebar/app-sidebar.component.d.ts(14,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-items.component.d.ts(11,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-items.component.d.ts(12,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.d.ts(15,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/@coreui/angular/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.d.ts(16,9): error TS1086: An accessor cannot be declared in an ambient context.
       chunk {2} polyfills.d64fff5b0a45205ed7b5.js (polyfills) 130 bytes [initial] [rendered]
       chunk {3} polyfills-es5.7f9896f05667ed1b2b2b.js (polyfills-es5) 68.1 kB [initial] [rendered]
       chunk {4} styles.f9d3d53855388a7c759d.css (styles) 578 kB [initial] [rendered]
       chunk {scripts} scripts.b59d910a7125cd182ed3.js (scripts) 471 kB [entry] [rendered]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! HireCommit@2.5.2 heroku-postbuild: `ng build --aot --prod`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the HireCommit@2.5.2 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.u9GWJ/_logs/2020-02-10T11_18_59_473Z-debug.log

Build failed



           We're sorry this build is failing! You can troubleshoot common issues here:
           https://devcenter.heroku.com/articles/troubleshooting-node-deploys

           If you're stuck, please submit a ticket so we can help:
           https://help.heroku.com/

           Love,
           Heroku

     !     Push rejected, failed to compile Node.js app.
     !     Push failed

Вы можете найти мой пакет. json здесь

Ответы [ 2 ]

1 голос
/ 10 февраля 2020

@ coreui / angular v2.9.0 использует Angular 9 и TypeScript 3.7

TS1086: метод доступа не может быть объявлен в окружающем контексте

Вы В ваших зависимостях есть машинописный текст v3.4.5, и эта проблема затрагивает вас. TypeScript 3.7 испускает методы доступа get / set в файлах .d.ts. Это может привести к серьезным изменениям в более старых версиях TypeScript, таких как 3.5 и более ранние версии.
- TypeScript 3.6 был рассчитан на будущее для этой функции.
- См .: Смягчение полей класса

  1. обновить ваш проект до Angular 9 https://update.angular.io/ и TypeScript до 3.6 / 3.7
  2. , другой вариант - заблокировать зависимость @ coreui / angular от версии 2.5.5 / 2.6.3
  3. или обновление @ coreui / angular до 2.9.1

@ coreui / angular v2.9.1 использует Angular Совместимость с 9 и TypeScript 3.6 - Angular 8

0 голосов
/ 23 февраля 2020

У меня похожая проблема в Bitbucket (не в Heroku). В моем случае у меня есть два варианта. Первый - обновить Angular Project и Ts. Но не возможно для моего случая. Второй - обновить основной интерфейс. Это работа для меня. отредактируйте пакет. json файл как

    "@angular/platform-browser-dynamic": "^8.0.0-rc.2",

     "@angular/router": "^8.0.0-rc.2",

-    "@coreui/angular": "^2.4.5", // remove

+    "@coreui/angular": "2.5.3", // add

     "@coreui/coreui": "^2.1.9",
...