离子2:在" npm install"之后发出警告

时间:2017-03-27 12:16:36

标签: node.js angular npm ionic2

我使用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安装警告。

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

1 个答案:

答案 0 :(得分:0)

您只需要将所有angular packages更新为2.4.8ionic-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