Как исправить предупреждения одноранговых зависимостей после обновления приложения Angular с версии 6 до 7 - PullRequest
0 голосов
/ 22 января 2019

Я купил шаблон администратора (от wrappixel), который является приложением Angular 6. Мне нужно обновить его до Angular версии 7. Я сделал это, используя

ng update --force --all

Обратите внимание, я должен был использовать параметр --force, чтобы убедиться, что обновление прошло, с целью исправления зависимостей одноранговых узлов после обновления

Следующие одноранговые зависимости теперь нужно исправить, потому что теперь сборка не работает:

npm WARN ng2-smart-table@1.3.5 requires a peer of ng2-completer@^2.0.8 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-smart-table@1.3.5 requires a peer of @angular/common@^6.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-smart-table@1.3.5 requires a peer of @angular/core@^6.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-smart-table@1.3.5 requires a peer of @angular/forms@^6.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-quill@4.5.0 requires a peer of quill@^1.3.6 but none is installed. You must install peer dependencies yourself.

Прочитав различные статьи о взаимных зависимостях (включая Зависимости от одноранговых узлов , в которых много говорится о плагинах), я все еще не знаю, как интерпретировать значение этих предупреждений или что делать, чтобы их исправить.

Итак, давайте возьмем первый:

ng2-smart-table@1.3.5 требует однорангового узла ng2-completer@^2.0.8

Что это значит?

Мой package.json содержит (в разделе зависимостей):

"ng2-smart-table": "^1.3.5",

ng2-завершителя нет в моем package.json, потому что это не прямая зависимость.

Так эта ошибка происходит из-за того, что в настоящее время она не указана как прямая зависимость, и она должна быть; т.е. я должен просто установить требуемую версию, чтобы она была прямой зависимостью? (npm install ng2-completer@^2.0.8 ??)

Я видел в других статьях, что есть «peerDependencies», которые могут входить в package.json, который я никогда не видел для себя. Так должен ли я создать этот раздел и добавить в него «ng2-completer@^2.0.8»? *

Без исправления этих одноранговых зависимостей, когда я собираюсь создать приложение, я получаю следующие ошибки:

λ ~/dev/github/js/wrappixel/admin-pro-angular-ng6-v2/admin-angular/ upgrade-framework* npm run start

> admin-angular@0.0.0 start /Users/Plastikfan/dev/github/js/wrappixel/admin-pro-angular-ng6-v2/admin-angular
> ng serve

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2019-01-22T13:20:28.970Z
Hash: c0785093f684bce10104
Time: 8859ms
chunk {main} main.js, main.js.map (main) 1.95 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 92.4 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 97.2 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 2.09 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 327 kB [initial] [rendered]

ERROR in multi ./src/styles.css ./node_modules/ngx-toastr/toastr.css ./node_modules/angular-calendar/css/angular-calendar.css ./node_modules/chartist/dist/chartist.css ./node_modules/quill/dist/quill.snow.css ./node_modules/dragula/dist/dragula.css ./src/assets/scss/style.scss
Module not found: Error: Can't resolve '/Users/Plastikfan/dev/github/js/wrappixel/admin-pro-angular-ng6-v2/admin-angular/node_modules/quill/dist/quill.snow.css' in '/Users/Plastikfan/dev/github/js/wrappixel/admin-pro-angular-ng6-v2/admin-angular'
ERROR in src/app/apps/apps.module.ts(7,31): error TS2307: Cannot find module 'ng2-dragula/ng2-dragula'.
src/app/apps/apps.module.ts(17,66): error TS2554: Expected 1-2 arguments, but got 0.
src/app/apps/fullcalendar/fullcalendar.component.ts(5,102): error TS2307: Cannot find module 'date-fns'.
src/app/charts/chartist-js/chartistjs.component.ts(3,39): error TS2307: Cannot find module 'ng-chartist/dist/chartist.component'.
src/app/charts/chartist-js/dynamic.component.ts(2,27): error TS2307: Cannot find module 'ng-chartist/dist/chartist.component'.
src/app/extra-component/drag-n-drop/drag.component.ts(11,25): error TS2339: Property 'subscribe' does not exist on type '(groupName?: string) => Observable<{ name: string; el: Element; source: Element; }>'.
src/app/extra-component/drag-n-drop/drag.component.ts(15,25): error TS2339: Property 'subscribe' does not exist on type '(groupName?: string) => Observable<{ name: string; el: Element; target: Element; source: Element; sibling: Element; }>'.
src/app/extra-component/drag-n-drop/drag.component.ts(19,25): error TS2339: Property 'subscribe' does not exist on type '(groupName?: string) => Observable<{ name: string; el: Element; container: Element; source: Element; }>'.
src/app/extra-component/drag-n-drop/drag.component.ts(23,24): error TS2339: Property 'subscribe' does not exist on type '(groupName?: string) => Observable<{ name: string; el: Element; container: Element; source: Element; }>'.
src/app/extra-component/drag-n-drop/drag.component.ts(27,30): error TS2339: Property 'subscribe' does not exist on type '<T = any>(groupName?: string) => Observable<{ name: string; el: Element; target: Element; source: Element; sibling: Element; item: T; sourceModel: T[]; targetModel: T[]; sourceIndex: number; targetIndex: number; }>'.
src/app/extra-component/drag-n-drop/drag.component.ts(30,32): error TS2339: Property 'subscribe' does not exist on type '<T = any>(groupName?: string) => Observable<{ name: string; el: Element; container: Element; source: Element; item: T; sourceModel: T[]; sourceIndex: number; }>'.

ℹ 「wdm」: Failed to compile.

В нескольких файлах css существует ошибка multi , не удается найти ошибки модулей, а ошибка "Свойство подписки" не существует для типа ". Я не знаю, связаны ли они с предупреждениями о зависимостях, но полагаю, что это так.

В моем angular.json мой раздел "стили" включает в себя:

    "styles": [
      "src/styles.css",
      "node_modules/ngx-toastr/toastr.css",
      "node_modules/angular-calendar/css/angular-calendar.css", 
      "node_modules/chartist/dist/chartist.css",
      "node_modules/quill/dist/quill.snow.css",
      "node_modules/dragula/dist/dragula.css",
      "src/assets/scss/style.scss"
    ],

и эти css-файлы соответствуют сообщению об ошибке «ОШИБКА в мульти». Я нашел другую статью, в которой упоминается, что «src / styles.css» следует заменить на «styles.css», я пробовал это, но это не имело никакого значения.

Также:

ng2-smart-table@1.3.5 requires a peer of @angular/common@^6.0.1
ng2-smart-table@1.3.5 requires a peer of @angular/core@^6.0.1
ng2-smart-table@1.3.5 requires a peer of @angular/forms@^6.0.1

Похоже, что ng2-smart-table@1.3.5 зависит от Angular 6, но я только что обновил проект до Angular 7. Так же как и проблема "ng2-smart-table@1.3.5" и зависимость Нужно перейти на более позднюю версию, которая работает с Angular 7?

Я надеюсь, что кто-нибудь может помочь мне исправить предупреждения о зависимостях одноранговых узлов с конечной целью исправить все эти ошибки сборки.

Спасибо.

1 Ответ

0 голосов
/ 23 января 2019

Если вы еще не установили этот модуль, установите его.

npm i ng2-completer --save

ну эта зависимость не нужна все время.Я недавно столкнулся с этой проблемой.В моем проекте он работает без модуля, но во втором я его установил.И тогда все работает нормально.

Для другой ошибки css это похоже на проблему css.Убедитесь, что вы получили CSS правильно.В противном случае попробуйте ./node-modules... в массиве стилей.

За последний выпуск.Убедитесь, что у вас есть эти зависимости в вашем package.josn.

"dependencies": {
    "@agm/core": "^1.0.0-beta.3",
    "@angular/animations": "^6.0.2",
    "@angular/common": "^6.0.2",
    "@angular/compiler": "^6.0.2",
    "@angular/core": "^6.0.2",
    "@angular/forms": "^6.0.2"
    ....
}
...