【问题标题】:Ionic 2 : Warn after "npm install"Ionic 2:“npm install”后发出警告
【发布时间】:2017-03-27 12:16:35
【问题描述】:

我使用 Ionic v2.1.8,当我运行命令“npm install”时,我有很多这样的警告:

C:\xampp\htdocs\AppFineMobile>npm install
npm WARN @angular/compiler@2.4.8 requires a peer of @angular/core@2.4.8 but none was installed.
npm WARN @angular/compiler-cli@2.4.8 requires a peer of @angular/core@2.4.8 but none was installed.
npm WARN @angular/forms@2.4.8 requires a peer of @angular/core@2.4.8 but none was installed.
npm WARN @angular/forms@2.4.8 requires a peer of @angular/common@2.4.8 but none was installed.
npm WARN @angular/http@2.4.8 requires a peer of @angular/core@2.4.8 but none was installed.
npm WARN @angular/http@2.4.8 requires a peer of @angular/platform-browser@2.4.8 but none was installed.
npm WARN @angular/platform-browser-dynamic@2.4.8 requires a peer of @angular/core@2.4.8 but none was installed.
npm WARN @angular/platform-browser-dynamic@2.4.8 requires a peer of @angular/common@2.4.8 but none was installed.
npm WARN @angular/platform-browser-dynamic@2.4.8 requires a peer of @angular/platform-browser@2.4.8 but none was installed.
npm WARN @angular/platform-server@2.4.8 requires a peer of @angular/core@2.4.8 but none was installed.
npm WARN @angular/platform-server@2.4.8 requires a peer of @angular/common@2.4.8 but none was installed.
npm WARN @angular/platform-server@2.4.8 requires a peer of @angular/platform-browser@2.4.8 but none was installed.
npm WARN ionic-angular@2.2.0 requires a peer of @angular/common@2.4.8 but none was installed.
npm WARN ionic-angular@2.2.0 requires a peer of @angular/core@2.4.8 but none was installed.
npm WARN ionic-angular@2.2.0 requires a peer of @angular/platform-browser@2.4.8 but none was installed.
npm WARN ionic-angular@2.2.0 requires a peer of rxjs@5.0.1 but none was installed.
npm WARN ionic-angular@2.2.0 requires a peer of zone.js@0.7.2 but none was installed.

我的 package.json 文件:

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "test": "ng test"
  },
  "config": {
    "ionic_copy": "./config/copy.config.js"
  },
  "dependencies": {
    "@angular/common": "^2.4.0",
    "@angular/compiler": "^2.4.0",
    "@angular/compiler-cli": "^2.4.0",
    "@angular/core": "^2.4.0",
    "@angular/forms": "^2.4.0",
    "@angular/http": "^2.4.0",
    "@angular/platform-browser": "^2.4.0",
    "@angular/platform-browser-dynamic": "^2.4.0",
    "@angular/platform-server": "^2.4.0",
    "@angular/router": "^3.4.0",
    "@ionic/storage": "2.0.0",
    "font-awesome": "^4.7.0",
    "ionic-angular": "2.2.0",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",
    "rxjs": "^5.1.0",
    "sw-toolbox": "3.4.0",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0",
    "@ionic/app-scripts": "1.1.4",
    "codecov": "^2.1.0",
    "jasmine-core": "^2.5.2",
    "karma": "^1.5.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-jasmine": "^1.1.0",
    "karma-mocha-reporter": "^2.2.3",
    "karma-remap-istanbul": "^0.6.0",
    "typescript": "2.0.9"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "ionic-plugin-keyboard",
    "cordova-plugin-splashscreen"
  ],
  "cordovaPlatforms": [],
  "description": "AppFineMobile: An Ionic project"
}

我不明白,因为我的 node_modules 文件夹中有这些模块。当我尝试安装其中一个时,我会在另一个 npm install 中保留警告。

我真的不明白,我不知道如何解决这个问题

【问题讨论】:

  • 你能添加你的 package.json 吗?一定有依赖问题
  • 当然。我已经更新了我的帖子

标签: node.js angular npm ionic2


【解决方案1】:

您只需将您的所有angular packages 更新为2.4.8。另外,您的ionic-angular 包是2.2.0

变化:

"@angular/common": "^2.4.8",
"@angular/compiler": "^2.4.8",
"@angular/compiler-cli": "^2.4.8",
"@angular/core": "^2.4.8",
"@angular/forms": "^2.4.8",
"@angular/http": "^2.4.8",
"@angular/platform-browser": "^2.4.8",
"@angular/platform-browser-dynamic": "^2.4.8",
"@angular/platform-server": "^2.4.8",

还有

"rxjs": "^5.0.1",
"zone.js" :"0.7.2"

如果出现问题,请清除您的 node_modules 文件夹并执行以下操作: npm install

【讨论】:

  • 哦,很好,没关系。但是现在我在 npm install 之后出现了 3 个新错误: UNMET PEER DEPENDENCY @angular/common@2.4.8 UNMET PEER DEPENDENCY @angular/core@2.4.8 UNMET PEER DEPENDENCY @angular/platform-b​​rowser@2.4.8 他们在红色。
猜你喜欢
  • 1970-01-01
  • 2015-02-25
  • 2020-10-26
  • 1970-01-01
  • 2022-01-20
  • 2019-04-05
  • 1970-01-01
  • 1970-01-01
  • 2021-08-17
相关资源
最近更新 更多