在ionic2上运行npm install时出错

时间:2017-05-04 14:55:56

标签: ionic2 npm-install

试图构建我的第一个应用程序。 尝试安装插件并遇到此错误问题:

  

npm WARN可选SKIPPING OPTIONAL DEPENDENCY:fsevents@^1.0.0   (node_modules \ chokidar \ node_modules \ fsevents):npm WARN notsup   跳过可选的依赖性:fsevents@1.1.1不支持的平台:   想要{“os”:“darwin”,“arch”:“any”}(当前:   {“os”:“win32”,“arch”:“x64”})npm WARN @ ionic-native / geolocation @ 3.6.1   需要@ ionic-native / core @ ^ 3.6.0的同伴,但没有安装。   npm WARN @ ionic-native / geolocation @ 3.6.1需要同伴   rxjs@^5.0.1但没有安装。警告   @ ionic-native / in-app-browser @ 3.6.1需要一个对等体   @ ionic-native / core @ ^ 3.6.0但没有安装。警告   @ ionic-native / in-app-browser @ 3.6.1需要rxjs@^5.0.1的对等,但是   没有安装。

想知道是否有人可以提供帮助

2 个答案:

答案 0 :(得分:1)

转到package.json并确保以下内容具有这些值

"dependencies": {
  "@angular/common": "4.0.2",
  "@angular/compiler": "4.0.2",
  "@angular/compiler-cli": "4.0.2",
  "@angular/core": "4.0.2",
  "@angular/forms": "4.0.2",
  "@angular/http": "4.0.2",
  "@angular/platform-browser": "4.0.2",
  "@angular/platform-browser-dynamic": "4.0.2",
  "@ionic-native/core": "^3.6.1",
  "@ionic-native/splash-screen": "3.4.2",
  "@ionic-native/status-bar": "3.4.2",
  "@ionic/storage": "2.0.1",
  "ionic-angular": "3.1.1",
  "ionicons": "3.0.0",
  "rxjs": "5.1.1",
  "sw-toolbox": "3.4.0",
  "zone.js": "^0.8.5"
},
"devDependencies": {
  "@ionic/app-scripts": "1.3.4",
  "typescript": "~2.2.1"
}

这是使用最新Ionic版本所需的,可能您的@ionic-native/corerxjs不在此版本中,因为错误说它需要的版本高于您拥有的版本。

更改您的package.json,删除项目的node_modules文件夹,然后在其中运行npm install

希望这有帮助

答案 1 :(得分:0)

这是我的package.json

"dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic-native/geolocation": "^3.6.1",
    "@ionic-native/in-app-browser": "^3.6.1",
    "@ionic/storage": "1.1.7",
    "ionic-angular": "2.0.0-rc.5",
    "ionic-native": "2.2.11",
    "ionicons": "3.0.0",
    "ng-material-floating-button": "^0.6.2",
    "rxjs": "5.0.0-beta.12",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.0.0",
    "typescript": "2.0.9"
  },
  "description": "ion_city_view: An Ionic project",
  "cordovaPlugins": [],
  "cordovaPlatforms": []
}
相关问题