npm PERINGATAN ... membutuhkan rekan dari ... tetapi tidak ada yang diinstal. Anda harus menginstal dependensi rekan sendiri

207

Saya mencoba menjalankan proyek yang diunduh dari github . Sayangnya, selama npm installperingatan berikut ditunjukkan. Saya mencoba mengubah versi berdasarkan pertanyaan ini . Namun, saya punya masalah, karena beberapa paket memerlukan beberapa versi paket lain. Pertimbangkan dua baris ini:

npm WARN @angular/cdk@2.0.0-beta.10 requires a peer of @angular/core@^4.3.0 but none is installed. You must install peer dependencies yourself.

npm WARN @angular/forms@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.

Jadi, menginstal beberapa paket menyebabkan daftar dependensi tumbuh secara substansial.

Adakah yang punya solusi?

npm WARN @angular/animations@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/cdk@2.0.0-beta.10 requires a peer of @angular/core@^4.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/cdk@2.0.0-beta.10 requires a peer of @angular/common@^4.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler-cli@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@4.3.6 requires a peer of @angular/common@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@4.3.6 requires a peer of @angular/platform-browser@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@4.3.6 requires a peer of @angular/platform-browser@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/material@2.0.0-beta.10 requires a peer of @angular/core@^4.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/material@2.0.0-beta.10 requires a peer of @angular/common@^4.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser-dynamic@2.4.10 requires a peer of @angular/compiler@2.4.10 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@4.3.6 requires a peer of @angular/common@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-server@4.3.6 requires a peer of @angular/platform-browser@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@4.3.6 requires a peer of @angular/core@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@4.3.6 requires a peer of @angular/common@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@4.3.6 requires a peer of @angular/platform-browser@4.3.6 but none is installed. You must install peer dependencies yourself.
npm WARN angularfire2@2.0.0-beta.7-pre requires a peer of @angular/compiler@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN extract-text-webpack-plugin@3.0.0 requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself.

Berikut isinya package.json:

{
  "name": "fireplace",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/name/fireplace.git"
  },
  "author": "name",
  "bugs": {
    "url": "https://github.com/name/fireplace/issues"
  },
  "homepage": "https://github.com/name/fireplace",
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.0-rc.2",
    "@angular/common": "^4.0.0-rc.2",
    "@angular/compiler": "^4.0.0-rc.2",
    "@angular/compiler-cli": "^4.0.0-rc.2",
    "@angular/core": "^4.0.0-rc.2",
    "@angular/flex-layout": "^2.0.0-rc.1",
    "@angular/forms": "^4.0.0-rc.2",
    "@angular/http": "^4.0.0-rc.2",
    "@angular/material": "^2.0.0-beta.2",
    "@angular/platform-browser": "^4.0.0-rc.2",
    "@angular/platform-browser-dynamic": "^4.0.0-rc.2",
    "@angular/platform-server": "^4.0.0-rc.2",
    "@angular/router": "^4.0.0-rc.2",
    "@types/lodash": "^4.14.53",
    "angular2-google-maps": "^0.17.0",
    "angular2-moment": "^1.2.0",
    "angularfire2": "^2.0.0-beta.8",
    "core-js": "^2.4.1",
    "d3": "^4.7.1",
    "d3-cloud": "^1.2.4",
    "firebase": "^3.6.10",
    "hammerjs": "^2.0.8",
    "lodash": "^4.17.4",
    "rxjs": "^5.2.0",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-rc.1",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "2.5.2",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-coverage-istanbul-reporter": "^0.2.1",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "^2.2.1",
    "webpack": "^2.2.1"
  }
}

ng serve Returns (Saya hanya menempel awal dan akhir):

ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/bidi/index.d.ts (8,99): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/portal/portal.d.ts (8,85): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/portal/portal-directives.d.ts (8,76): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/portal/dom-portal-host.d.ts (8,31): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/ripple/ripple-renderer.d.ts (9,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/ripple/ripple-renderer.d.ts (10,31): Cannot find module '@angular/cdk/scrolling'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/ripple/ripple.d.ts (9,31): Cannot find module '@angular/cdk/scrolling'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/ripple/ripple.d.ts (10,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/platform/platform.d.ts (8,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/keyboard/keycodes.d.ts (8,146): Cannot find module '@angular/cdk/keycodes'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/core.d.ts (1,61): Cannot find module '@angular/cdk/coercion'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/core.d.ts (2,49): Cannot find module '@angular/cdk/observers'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/core.d.ts (3,32): Cannot find module '@angular/cdk/collections'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/core.d.ts (9,15): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/core.d.ts (10,15): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/core.d.ts (14,252): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/autocomplete/autocomplete.d.ts (10,44): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/autocomplete/autocomplete-trigger.d.ts (10,32): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/autocomplete/autocomplete-trigger.d.ts (11,67): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/button/button.d.ts (9,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/a11y/focus-key-manager.d.ts (8,50): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/chips/chip-list.d.ts (10,33): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/chips/chip-list.d.ts (11,32): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/dialog/dialog-config.d.ts (9,27): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/dialog/dialog-container.d.ts (10,86): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/dialog/dialog-container.d.ts (11,34): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/dialog/dialog-ref.d.ts (8,28): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/dialog/dialog.d.ts (10,31): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/dialog/dialog.d.ts (11,62): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/datepicker/datepicker.d.ts (9,67): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/datepicker/datepicker.d.ts (10,32): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/grid-list/grid-list.d.ts (10,32): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/input/autosize.d.ts (10,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/input/input.d.ts (10,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/menu/menu-panel.d.ts (10,27): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/menu/menu-directive.d.ts (14,27): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/menu/menu-trigger.d.ts (9,43): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/menu/menu-trigger.d.ts (10,67): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/select/select.d.ts (10,33): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/select/select.d.ts (11,32): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/select/select.d.ts (12,109): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/select/select.d.ts (14,32): Cannot find module '@angular/cdk/collections'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/select/select.d.ts (19,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/core/a11y/focus-trap.d.ts (8,95): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/slider/slider.d.ts (10,32): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/slide-toggle/slide-toggle.d.ts (9,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/snack-bar/snack-bar-config.d.ts (9,36): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/snack-bar/snack-bar-config.d.ts (10,27): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/snack-bar/snack-bar-container.d.ts (10,70): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/snack-bar/snack-bar-ref.d.ts (8,28): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/snack-bar/snack-bar.d.ts (9,25): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/snack-bar/snack-bar.d.ts (10,31): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/snack-bar/snack-bar.d.ts (11,31): Cannot find module '@angular/cdk/a11y'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/sort/sort-header.d.ts (9,30): Cannot find module '@angular/cdk/table'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/table/cell.d.ts (9,84): Cannot find module '@angular/cdk/table'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/table/table.d.ts (1,26): Cannot find module '@angular/cdk/table'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/table/row.d.ts (1,66): Cannot find module '@angular/cdk/table'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tabs/tab-label.d.ts (9,41): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tabs/tab-body.d.ts (10,53): Cannot find module '@angular/cdk/portal'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tabs/tab-body.d.ts (11,43): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tabs/tab-header.d.ts (9,43): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tabs/tab-nav-bar/tab-nav-bar.d.ts (9,31): Cannot find module '@angular/cdk/scrolling'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tabs/tab-nav-bar/tab-nav-bar.d.ts (10,32): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tabs/tab-nav-bar/tab-nav-bar.d.ts (11,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tooltip/tooltip.d.ts (10,34): Cannot find module '@angular/cdk/scrolling'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tooltip/tooltip.d.ts (12,32): Cannot find module '@angular/cdk/bidi'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tooltip/tooltip.d.ts (13,26): Cannot find module '@angular/cdk/platform'.
ERROR in /Users/username/Projects/fireplace/node_modules/@angular/material/typings/tooltip/tooltip.d.ts (14,132): Cannot find module '@angular/cdk/overlay'.
ERROR in /Users/username/Projects/fireplace/src/auth/auth.module.ts (24,24): Property 'forRoot' does not exist on type 'typeof MaterialModule'.
ERROR in /Users/username/Projects/fireplace/src/common/data.model.ts (25,14): Type 'Feed' has no properties in common with type 'IFeed'.
ERROR in /Users/username/Projects/fireplace/src/common/data.model.ts (32,14): Type 'Like' has no properties in common with type 'ILike'.
ERROR in /Users/username/Projects/fireplace/src/common/data.model.ts (39,14): Type 'Follower' has no properties in common with type 'IFollower'.
ERROR in /Users/username/Projects/fireplace/src/sign-in/sign-in.module.ts (21,24): Property 'forRoot' does not exist on type 'typeof MaterialModule'.
ERROR in /Users/username/Projects/fireplace/src/word-cloud/word-cloud.component.ts (192,25): Property 'items' does not exist on type '{}'.
ERROR in /Users/username/Projects/fireplace/src/word-cloud/word-cloud.component.ts (192,51): Property 'items' does not exist on type '{}'.
ERROR in Error encountered resolving symbol values statically. Calling function 'OpaqueToken', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol FirebaseUserConfig in /Users/username/Projects/fireplace/node_modules/angularfire2/tokens.d.ts, resolving symbol AngularFireModule.initializeApp in /Users/username/Projects/fireplace/node_modules/angularfire2/angularfire2.d.ts, resolving symbol FirebaseModule in /Users/username/Projects/fireplace/src/firebase/firebase.module.ts, resolving symbol AppModule in /Users/username/Projects/fireplace/src/app/app.module.ts, resolving symbol AppModule in /Users/username/Projects/fireplace/src/app/app.module.ts
ERROR in ./node_modules/@angular/material/@angular/material.es5.js
Module not found: Error: Can't resolve '@angular/cdk/a11y' in '/Users/username/Projects/fireplace/node_modules/@angular/material/@angular'
resolve '@angular/cdk/a11y' in '/Users/username/Projects/fireplace/node_modules/@angular/material/@angular'
  Parsed request is a module
  using description file: /Users/username/Projects/fireplace/node_modules/@angular/material/package.json (relative path: ./@angular)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/username/Projects/fireplace/node_modules/@angular/material/package.json (relative path: ./@angular)
    resolve as module
[/Users/username/Projects/fireplace/node_modules/@angular/cdk/table]
[/Users/username/Projects/fireplace/node_modules/@angular/cdk/table.ts]
[/Users/username/Projects/fireplace/node_modules/@angular/cdk/table.js]
[/Users/username/Projects/fireplace/node_modules/@angular/cdk/table]
[/Users/username/Projects/fireplace/node_modules/@angular/cdk/table]
[/Users/username/Projects/fireplace/node_modules/@angular/cdk/table.ts]
[/Users/username/Projects/fireplace/node_modules/@angular/cdk/table.js]
[/Users/username/Projects/fireplace/node_modules/@angular/cdk/table]
[/Users/username/Projects/fireplace/src/@angular/cdk/table]
[/Users/username/Projects/fireplace/src/@angular/cdk/table.ts]
[/Users/username/Projects/fireplace/src/@angular/cdk/table.js]
[/Users/username/Projects/fireplace/src/@angular/cdk/table]
[/Users/username/Projects/fireplace/src/@angular/cdk/table]
[/Users/username/Projects/fireplace/src/@angular/cdk/table.ts]
[/Users/username/Projects/fireplace/src/@angular/cdk/table.js]
[/Users/username/Projects/fireplace/src/@angular/cdk/table]
 @ ./node_modules/@angular/material/@angular/material.es5.js 34:0-218
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/theme.scss
Module build failed: 
@import '~@angular/material/core/theming/all-theme';
^
      File to import not found or unreadable: ~@angular/material/core/theming/all-theme.
Parent style sheet: stdin
      in /Users/username/Projects/fireplace/src/theme.scss (line 1, column 1)
Error: 
@import '~@angular/material/core/theming/all-theme';
^
      File to import not found or unreadable: ~@angular/material/core/theming/all-theme.
Parent style sheet: stdin
      in /Users/username/Projects/fireplace/src/theme.scss (line 1, column 1)
    at options.error (/Users/username/Projects/fireplace/node_modules/node-sass/lib/index.js:291:26)
 @ ./src/theme.scss 4:14-186
 @ multi ./src/theme.scss ./src/styles.scss

webpack: Failed to compile.
David Eldridge
sumber
4
Okey, tapi ketika saya lakukan misalnya sudo npm install @angular/[email protected] saya masih punyanpm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
Ini adalah peringatan. Anda dapat mengabaikannya. Apakah Anda mencoba menjalankan proyek? Apakah ini berfungsi dengan baik? Atau Anda juga mendapatkan kesalahan saat menjalankan
Karan Garg
@KaranGarg ng melayani kesalahan pengembalian. Saya menambahkannya ke pertanyaan yang diperbarui.
4
@KaranGarg Saya memiliki masalah serupa dan ingin tidak "Mengabaikan peringatan" Konfigurasi apa yang diperlukan untuk tidak menampilkan jenis peringatan ini. Catatan: untuk proyek saya npm WARN [email protected] requires a peer of react@^16.0.0 but none is installed.dan ya saya sudah menginstal peer yang diperlukan. Apakah ini masalah dengan proyek saya atau masalah dengan react-test-rendererproyek?
Matt
@ user7304253 jangan pernah melakukan sudo npmapa punEVER
Zach_is_my_name

Jawaban:

143

"A membutuhkan rekan B tetapi tidak ada yang dipasang" Anggap itu sebagai "A membutuhkan salah satu rekan B tetapi rekan itu tidak diinstal dan kami tidak memberi tahu Anda yang mana dari rekan B yang Anda butuhkan."

Instalasi otomatis dependensi rekan dihapus secara eksplisit dengan npm 3.

NPM Blog

Catatan rilis v3

Jadi Anda tidak dapat menginstal dependensi rekan secara otomatis dengan npm 3 dan yang lebih tinggi.

Solusi Terbaru:

Gunakan berikut ini untuk setiap ketergantungan rekan untuk menginstalnya dan menghapus kesalahan

npm install --save-dev xxxxx

Solusi usang:

  1. Anda dapat menggunakan npm-install-peer untuk menemukan dan menginstal dependensi rekan yang diperlukan.

    npm install -g npm-install-peers

    npm-install-peers

  2. Jika Anda mendapatkan kesalahan ini setelah memperbarui versi paket apa pun kemudian hapus node_modulesdirektori dan instal ulang paket dengan npm installatau npm cache cleandan npm install.

Ridham Tarpara
sumber
17
Saya men-debug masalah yang sama dengan OP dan npm-install-peer hanya kembaliThis package doesn't seem to have any peerDependencies
Lucas Gonze
perlu memeriksa karena saya telah menggunakan ini untuk sementara waktu
Ridham Tarpara
5
Untuk pembaca masa depan, ini bukan solusi yang tepat, karena npm-install-peershanya akan menginstal dependensi peer langsung , bukan dependensi peer dependensi Anda. Lihat halaman github tertaut mereka.
Pushkin
'npm cache clean' tidak berfungsi dengan lancar. Ini akan menampilkan kesalahan dan referensi ke sth. seperti 'npm install --cache / tmp / kosong-cache'! 'Npm cache memverifikasi' juga tidak mengatakan 'ok' atau 'kesalahan' tetapi menyatakan apa yang dilakukannya dan bukan apa hasilnya.
Dirk Schumacher
5
"... untuk menginstal itu dan menghapus kesalahan" sepertinya bahasa Inggris salah. Juga tidak jelas bagaimana "xxxxx" berhubungan dengan Adan B.
Marc-André Lafortune
74

Untuk setiap kesalahan formulir:

npm WARN {something} requires a peer of {other thing} but none is installed. You must install peer dependencies yourself.

Anda harus:

$ npm install --save-dev "{other thing}"

Catatan : Kutipan diperlukan jika {other thing}memiliki spasi, seperti dalam contoh ini:

npm WARN rollup-plugin-uglify@6.0.3 requires a peer of rollup@>=0.66.0 <2 but none was installed.

Diselesaikan dengan:

$ npm install --save-dev "rollup@>=0.66.0 <2"
Marc-André Lafortune
sumber
4
BTW apa yang dilakukan '--save-dev'?
Gabriel Fair
1
--save-devmenyimpan dependensi sebagai dependensi pengembangan ke package.json- npm doc
Yuri
6
Tampaknya masih ada banyak kebingungan di sekitar ini. Akan sangat membantu jika NPM akan menampilkan perintah yang disarankan untuk menginstal dependensi rekan yang hilang.
pdoherty926
Apakah mungkin menginstal {other thing}secara global? Saya tidak menggunakan package.jsonfile lokal , hanya instal global.
Markus Laire
35

Jawaban yang diterima menggunakan npm-install-peer tidak bekerja, atau menghapus node_modules dan membangun kembali. Jawaban untuk berlari

npm install --save-dev @xxxxx/xxxxx@latest

untuk masing-masing, dengan xxxxx yang merujuk ke teks yang tepat di peringatan rekan, bekerja. Saya hanya punya empat peringatan, jika saya punya selusin atau lebih seperti dalam pertanyaan, mungkin ide yang baik untuk menuliskan perintah.

Jelaskan
sumber
6
package@latestadalah jalan menuju lubang kelinci
Teedeez
10
Mengapa --save-dev? Bukankah itu menambah peerDependency sebagai devDependency di package.json?
Fabian Lauer
2
Mengapa tidak menyimpannya? Jika dependensi dev tidak ada paket yang diperlukan, ini harus ditambahkan dan disimpan ke devDependencies untuk memastikan instalasi selanjutnya oleh pengembang / CI akan memiliki modul simpul yang sama tersedia.
perry
9
mohon lebih eksplisit dalam "xxxxx merujuk ke teks yang tepat di peringatan rekan" npm WARN ABC requires a peer of XYZ@VER but none is installed. You must install peer dependencies yourself., haruskah kita menggunakan ABC, XYZ atau bagian lain dari peringatan?
Serge
6
@Serge saya menggunakan yang setara dari XYZ@VERcontoh Anda dan itu berhasil untuk saya
MoralCode
5

Saya memiliki masalah serupa dan diselesaikan setelah menjalankan instruksi ini!

npm install npm -g
npm install --save-dev @angular/cli@latest
npm install
npm start
Pengembang Pimpinan
sumber
1
Saya kira npm install npm -gitu bukan ide yang baik untuk semua orang karena itu akan diperbarui npm, benar?
Gabriel Fair
1
Benar. Dan berbicara tentang praktik terbaik, setiap pengembang simpul akan berakhir menggunakan nvmsuatu hari nanti. Itu dapat dengan mudah menjaga npmversi terbaru sesuai dengan nodeversi yang ingin Anda gunakan.
Pengembang Utama
0

Anda hanya perlu bergantung pada satu versi utama sudut, jadi perbarui semua modul tergantung pada sudut 2.x:

  • perbarui @ angular / flex-layout ke ^ 2.0.0-beta.9
  • perbarui @ angular / material ke ^ 2.0.0-beta.12
  • perbarui angularfire2 ke ^ 4.0.0-rc.2
  • perbarui zone.js ke ^ 0.8.18
  • perbarui webpack ke ^ 3.8.1
  • add @ angular / cdk @ 2.0.0-beta.12 (diperlukan untuk @ angular / material)
  • ganti angular2-google-maps dengan @ agm / core @ 1.0.0-beta.1 (nama baru)
Gabriel Bleu
sumber
7
Bisakah Anda menjelaskan dan memberikan solusi umum? Saya memiliki masalah serupa dan ingin tidak "Mengabaikan peringatan", seperti yang direkomendasikan dalam komentar di atas. Konfigurasi apa yang diperlukan untuk tidak menunjukkan jenis peringatan ini? Catatan: untuk proyek saya npm WARN [email protected] requires a peer of react@^16.0.0 but none is installed...dan ya saya sudah menginstal peer yang diperlukan. Apakah ini merupakan masalah dengan proyek saya atau masalah dengan proyek penilai-uji-reaksi? Atau apakah saya perlu menemukan semua rekan dan membuat versi mereka sejajar entah bagaimana?
Matt
0

total edge case di sini: Saya mengalami masalah ini menginstal file Arch AUR PKGBUILD secara manual. Dalam kasus saya, saya perlu menghapus folder 'pkg', 'src' dan 'node_modules', kemudian dibuat dengan baik tanpa kesalahan npm ini.

Elijah Lynn
sumber
0
npm install -g npm-install-peers

itu akan menambah semua rekan yang hilang dan menghapus semua kesalahan

Hukmaram
sumber
Hanya dependensi peer langsung di dalam paket Anda.json akan diinstal dari proyek Anda dengan perintah ini. Anda masih akan mendapatkan peringatan bahwa semua dependensi proyek Anda tidak memiliki dependensi rekan.
Sam
Ini tampaknya sudah usang untuk solusi yang diperlukan sekarang. Tidak berfungsi lagi
Ujjwal Singh
0

Dalam kasus saya, perintah berikut bekerja untuk saya:

sudo npm cache clean --force
sudo npm install -g npm


sudo apt install libssl1.0-dev
sudo apt install nodejs-dev
sudo apt install node-gyp
sudo apt install npm

Setelah itu jika Anda menghadapi "Tidak dapat menemukan modul 'bcrypt' maka untuk itu Anda dapat menyelesaikannya dengan perintah di bawah ini:

npm install node-gyp -g
npm install bcrypt -g
npm install bcrypt --save  

Semoga ini akan bekerja untuk Anda juga.

Jitendra
sumber
-1

Apakah masalah yang sama menginstal CDK material sudut:

npm install --save @angular/material @angular/cdk @angular/animations

Menambahkan -devseperti di bawah ini berfungsi untuk saya:

npm install --save-dev @angular/material @angular/cdk @angular/animations
Luckza
sumber