npm WARN… requer um par de… mas nenhum está instalado. Você deve instalar dependências entre pares


199

Tentei executar um projeto baixado do github . Infelizmente, durante npm installos seguintes avisos foram mostrados. Eu tentei mudar a versão com base nesta pergunta . No entanto, tive um problema, porque alguns pacotes exigem várias versões de outros pacotes. Considere estas duas linhas:

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.

Portanto, a instalação de alguns pacotes faz com que a lista de dependências cresça substancialmente.

Alguém tem uma solução?

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.

Aqui estão os conteúdos de 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 retorna (colei apenas o começo e o fim):

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.

4
Okey, mas quando eu faço, por exemplo, sudo npm install @angular/core@4.3.6 eu ainda tenhonpm WARN @angular/platform-browser@2.4.10 requires a peer of @angular/core@2.4.10 but none is installed. You must install peer dependencies yourself.

Estes são avisos. Você pode ignorá-los. Você tentou executar o projeto? É trabalhar bem Ou você também está recebendo erros durante a execução?
Karan Garg

O @KaranGarg ng serve retorna erros. Eu os adicionei à pergunta atualizada.

4
@KaranGarg Eu tenho um problema semelhante e gostaria de não "Ignorar avisos" Qual configuração é necessária para não mostrar esse tipo de aviso. Nota: para o meu projeto é npm WARN react-test-renderer@16.1.1 requires a peer of react@^16.0.0 but none is installed.e sim, tenho o par necessário instalado. Isso é um problema do meu projeto ou um problema do react-test-rendererprojeto?
22417 Matt

@ user7304253 nunca faz sudo npmnadaEVER
Zach_is_my_name

Respostas:


140

"A requer um par de B, mas nenhum foi instalado". Considere-o como "A requer um dos pares de B, mas esse ponto não foi instalado e não estamos dizendo a você quais dos pares de B você precisa".

A instalação automática de dependências entre pares foi removida explicitamente com o npm 3.

Blog do NPM

Notas da versão da v3

Portanto, você não pode instalar dependências entre pares automaticamente com o npm 3 e superior.

Solução atualizada:

Use o seguinte para cada dependência de pares para instalar isso e remover o erro

npm install --save-dev xxxxx

Solução preterida:

  1. Você pode usar o npm-install-peers para localizar e instalar as dependências necessárias.

    npm install -g npm-install-peers

    npm-install-peers

  2. Se você estiver recebendo esse erro após atualizar a versão de qualquer pacote, remova o node_modulesdiretório e reinstale os pacotes por npm installou npm cache cleane npm install.


17
Eu estou depurando o mesmo problema que o OP e retorna NPM-pares-instalar apenasThis package doesn't seem to have any peerDependencies
Lucas Gonze

preciso verificar como eu tenho usado isso por um tempo
Ridham Tarpara

5
Para futuros leitores, essa não é a solução correta, porque npm-install-peersinstalará apenas dependências diretas de pares, não dependências de suas dependências. Veja a página do github vinculada.
Pushkin

'npm cache clean' não funciona diretamente. Ele mostrará erros e referência a sth. como 'npm install --cache / tmp / empty-cache'! Além disso, 'npm cache Verifique' não informa unqily 'ok' ou 'error', mas afirma o que fez e não qual foi o resultado.
Dirk Schumacher

5
"... para instalar e remover o erro" parece um inglês incorreto. Também não está claro como "xxxxx" se relaciona com Ae B.
Marc-André Lafortune

72

Para cada erro do formulário:

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

Você deve:

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

Nota : As aspas são necessárias se {other thing}houver espaços, como neste exemplo:

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

Resolvido com:

$ npm install --save-dev "rollup@>=0.66.0 <2"

3
BTW, o que '--save-dev' faz?
Gabriel Fair

1
--save-devsalva a dependência como dependência de desenvolvimento para o seu package.json- npm doc
Yuri

5
Ainda parece haver muita confusão em torno disso. Seria realmente útil se o NPM emitisse o comando sugerido para instalar a dependência de pares ausentes.
pdoherty926 12/03

É possível instalar {other thing}globalmente? Não uso package.jsonarquivos locais , apenas instalações globais.
Markus Laire 17/04

34

A resposta aceita do uso do npm-install-peers não funcionou, nem remove o node_modules e a reconstrução. A resposta a ser executada

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

para cada um, com o xxxxx se referindo ao texto exato no aviso de pares, funcionou. Eu só tinha quatro avisos; se tivesse uma dúzia ou mais, como na pergunta, seria uma boa ideia escrever os comandos.


6
package@latesté o caminho para baixo o coelho
Teedeez

10
Por que --save-dev? Isso não adicionaria o peerDependency como um devDependency no package.json?
Fabian Lauer

2
Por que não salvá-lo? Se uma dependência de desenvolvimento estiver faltando, um pacote necessário deve ser adicionado e salvo no devDependencies para garantir que a próxima instalação do desenvolvedor / IC tenha os mesmos módulos de nó disponíveis.
Perry

9
seja mais explícito em "xxxxx, referindo-se ao texto exato no aviso de pares" npm WARN ABC requires a peer of XYZ@VER but none is installed. You must install peer dependencies yourself., devemos usar ABC, XYZ ou outra parte do aviso?
Serge

6
@Serge eu usei o equivalente a XYZ@VERpartir do seu exemplo e funcionou para mim
MoralCode

5

Eu tive um problema semelhante e resolvi depois de executar estas instruções!

npm install npm -g
npm install --save-dev @angular/cli@latest
npm install
npm start

1
Eu suspeito que npm install npm -gnão é uma boa idéia para todos, pois isso seria atualizado npm, correto?
Gabriel Fair

1
Corrigir. E por falar em boas práticas, todo desenvolvedor de nó acabará usando nvmalgum dia. Ele pode facilmente manter a npmversão atualizada de acordo com a nodeversão que você pretende usar.
Lead Developer

0

Você precisa depender apenas de uma versão principal do angular; portanto, atualize todos os módulos, dependendo do angular 2.x:

  • atualize @ angular / flex-layout para ^ 2.0.0-beta.9
  • atualizar @ angular / material para ^ 2.0.0-beta.12
  • atualize angularfire2 para ^ 4.0.0-rc.2
  • atualize zone.js para ^ 0.8.18
  • atualize o webpack para ^ 3.8.1
  • adicione @ angular / cdk @ 2.0.0-beta.12 (necessário para @ angular / material)
  • substitua angular2-google-maps por @ agm / core @ 1.0.0-beta.1 (novo nome)

7
Você poderia expor e fornecer uma solução generalizada? Eu tenho um problema semelhante e gostaria de não "Ignorar avisos", conforme recomendado nos comentários acima. Qual configuração é necessária para não mostrar esse tipo de aviso? Nota: para o meu projeto é npm WARN react-test-renderer@16.1.1 requires a peer of react@^16.0.0 but none is installed...e sim, tenho o par necessário instalado. Esse é um problema com meu projeto ou com o projeto react-test-renderer? Ou preciso encontrar todos os pares e alinhar suas versões de alguma forma?
Matt #

0

caso de borda total aqui: tive esse problema ao instalar um arquivo Arch AUR PKGBUILD manualmente. No meu caso, eu precisava excluir as pastas 'pkg', 'src' e 'node_modules' e, em seguida, ele criou muito bem sem esse erro npm.


0
npm install -g npm-install-peers

ele adicionará todos os pares ausentes e removerá todo o erro


Somente dependências diretas de pares dentro do seu package.json serão instaladas no seu projeto com este comando. Você ainda receberá avisos de que todas as dependências de seus projetos estão ausentes.
Sam

Isso parece estar obsoleto para a solução necessária agora. Não funciona mais
Ujjwal Singh

0

No meu caso, os seguintes comandos funcionaram para mim:

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

Depois disso, se você estiver enfrentando "Não é possível encontrar o módulo 'bcrypt', então para isso você pode resolver este com os comandos abaixo:

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

Espero que funcione para você também.


-1

Teve o mesmo problema ao instalar o material angular CDK:

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

Adicionando -devcomo abaixo funcionou para mim:

npm install --save-dev @angular/material @angular/cdk @angular/animations
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.