2017-04-22 50 views
0

所以我按照指示在這裏:https://github.com/driftyco/ionic/blob/master/CHANGELOG.md#steps-to-upgrade2從Ionic 2.2.0升級到3.0.1打破了一切。奇怪的錯誤

後,我升級,並確保我在最新的CLI測試,當我輸入離子發球,這是錯誤:

Runtime Error 
Cannot find module "../../node_modules/@angular/core/src/metadata/di" 
Stack 
Error: Cannot find module "../../node_modules/@angular/core/src/metadata/di" 
    at g (http://localhost:8100/build/polyfills.js:3:7133) 
    at Object.<anonymous> (http://localhost:8100/build/main.js:91192:7) 
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30) 
    at Object.<anonymous> (http://localhost:8100/build/main.js:90791:73) 
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30) 
    at Object.<anonymous> (http://localhost:8100/build/main.js:161802:70) 
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30) 
    at Object.defineProperty.value (http://localhost:8100/build/main.js:66:18) 
    at http://localhost:8100/build/main.js:69:10 
Ionic Framework: 3.0.1 
Ionic App Scripts: 1.3.4 
Angular Core: 4.0.0 
Angular Compiler CLI: 4.0.0 
Node: 7.5.0 
OS Platform: macOS Sierra 
Navigator Platform: MacIntel 
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 

以供參考。這裏是我的package.json文件:

"dependencies": { 
    "@angular/animations": "4.0.0", 
    "@angular/common": "4.0.0", 
    "@angular/compiler": "4.0.0", 
    "@angular/compiler-cli": "4.0.0", 
    "@angular/core": "4.0.0", 
    "@angular/forms": "4.0.0", 
    "@angular/http": "4.0.0", 
    "@angular/platform-browser": "4.0.0", 
    "@angular/platform-browser-dynamic": "4.0.0", 
    "@angular/platform-server": "4.0.0", 
    "@ionic-native/core": "^3.4.2", 
    "@ionic-native/google-plus": "^3.4.4", 
    "@ionic-native/in-app-browser": "^3.5.0", 
    "@ionic-native/keyboard": "^3.5.0", 
    "@ionic-native/social-sharing": "^3.5.0", 
    "@ionic-native/splash-screen": "3.4.2", 
    "@ionic-native/status-bar": "^3.4.2", 
    "@ionic/storage": "2.0.1", 
    "angular2-elastic": "^0.13.0", 
    "angularfire2": "^2.0.0-beta.8", 
    "firebase": "^3.8.0", 
    "font-awesome": "^4.7.0", 
    "imgcache.js": "^1.0.0", 
    "ionic-angular": "3.0.1", 
    "ionic-image-loader": "^1.7.2", 
    "ionicons": "^3.0.0", 
    "ng2-cordova-oauth": "0.0.8", 
    "ng2-validation": "^3.8.0", 
    "rxjs": "5.1.1", 
    "sw-toolbox": "3.4.0", 
    "zone.js": "^0.8.4" 
    }, 
    "devDependencies": { 
    "@ionic/app-scripts": "1.3.4", 
    "typescript": "2.2.2" 
    }, 

我暫停錯誤由AngularFire導致B/C有NPM運行安裝時,這樣的警告:

npm WARN [email protected] requires a peer of @angular/[email protected]^2.0.0 but none was installed. 
npm WARN [email protected] requires a peer of @angular/[email protected]^2.0.0 but none was installed. 
npm WARN [email protected] requires a peer of @angular/[email protected]^2.0.0 but none was installed. 
npm WARN [email protected] requires a peer of @angular/[email protected]^2.0.0 but none was installed. 
npm WARN [email protected] requires a peer of @angular/[email protected]^2.0.0 but none was installed. 

但我不知道是什麼繼續參考不在Angular 4中的di文件!請幫忙!

+0

您是否嘗試刪除'node_modules'文件夾? – int11

+0

是的。我刪除整個node_modules文件夾。它沒有幫助。 –

回答

1

我相信問題是你的ionic-image-loader包,它目前在1.7.2。 根據changelog herenpm中的當前版本爲3.1.1

它在2.0.0中升級爲使用ionic-native版本3。嘗試升級這個軟件包。

ng2-validation也移動到3.9.0角4。

您可能需要根據更新日誌重構您的應用程序。

+0

謝謝!我確實確保所有的軟件包都是最新的。只有AngularFire與Angular4.0不兼容。但是ppl正在使用AngularFire beta 8,沒有問題。 –

1

整夜調試後,我發現這個問題。這是導致這個問題的原因:IDE自動導入語句。我使用Webstorm,並自動爲我導入所有內容。而且,由於他們摺疊並隱藏大項目的導入,我錯過了這個問題。所以如果你有類似的進口問題(它可以是任何東西,不僅僅是元數據/ di,它也發生在我的@ angular/form/...上),在問題陳述上做一個完整的項目搜索。對我來說,這條線:

import {ViewChild} from "../../node_modules/@angular/core/src/metadata/di" 

後,我把它改成

import {ViewChild} from "@angular/core" 

錯誤消失。希望這有助於其他人將他們的項目從Angular 2.x移動到Angular 4.x.

相關問題