2016-11-14 23 views
2

我正在運行Windows 7 64位並且正在嘗試設置Ionic Framework。我已經在v1中正常工作,但是在通過安裝Windows SDK修復了一些與VCBuild相關的問題後,ionic serve在通過ionic start MyApp blank --v2創建新項目後失敗。Ionic Framework:離線服務在新安裝後的示例項目中失敗

我得到正常的輸出從腳本:

[20:53:13] ionic-app-scripts 0.0.43 
[20:53:13] watch started ... 
[20:53:13] build dev started ... 
[20:53:13] clean started ... 
[20:53:13] clean finished in 16 ms 
[20:53:13] copy started ... 
[20:53:13] transpile started ... 
[20:53:18] transpile finished in 5.17 s 
[20:53:18] webpack started ... 
[20:53:18] copy finished in 5.40 s 
[20:53:18] webpack finished in 281 ms 
[20:53:18] sass started ... 
[20:53:20] sass finished in 1.33 s 
[20:53:20] build dev finished in 6.79 s 
[20:53:20] watch ready in 6.95 s 
[20:53:20] dev server running: http://localhost:8100/ 

但頁面提供的瀏覽器是空白與下面的JavaScript錯誤控制檯:

Uncaught Error: Module build failed: TypeError: Cannot read property 'content' of undefined 
    at Object.typescriptSourcemapLoaderMemory (C:\Users\Me\Documents\ionic\MyApp\node_modules\@ionic\app-scripts\dist\webpack\typescript-sourcemap-loader-memory.js:18:34) 
    at Object.typescriptSourcemapLoaderMemory (C:\Users\Me\Documents\ionic\MyApp\node_modules\@ionic\app-scripts\dist\webpack\typescript-sourcemap-loader-memory.js:18:34) 
    at eval (webpack:///C:/Users/Me/Documents/ionic/MyApp/src/app/main.dev.ts?:1:7) 
    at Object.<anonymous> (http://localhost:8100/build/main.js:71:1) 
    at __webpack_require__ (http://localhost:8100/build/main.js:20:30) 
    at http://localhost:8100/build/main.js:64:18 
    at http://localhost:8100/build/main.js:67:10 

經進一步檢查,WWW /build/main.js文件應該從打字稿源生成,該文件末尾有此錯誤的來源:

/******/ ([ 
/* 0 */ 
/***/ function(module, exports) { 

eval("throw new Error(\"Module build failed: TypeError: Cannot read property 'content' of undefined\\n at Object.typescriptSourcemapLoaderMemory (C:\\\\Users\\\\Mack\\\\Documents\\\\ionic\\\\chatroom\\\\node_modules\\\\@ionic\\\\app-scripts\\\\dist\\\\webpack\\\\typescript-sourcemap-loader-memory.js:18:34)\");\n\n//////////////////\n// WEBPACK FOOTER\n// C:/Users/Mack/Documents/ionic/chatroom/src/app/main.dev.ts\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///C:/Users/Mack/Documents/ionic/chatroom/src/app/main.dev.ts?"); 

/***/ } 
/******/ ]); 

所以看起來問題在於打字稿的構建過程 - 但沒有一個腳本抱怨。清理和/或手動刪除www/build目錄不起作用,文件將以相同方式重建。

如何解決這個問題呢?我已經搜索,但沒有發現這個問題在其他地方。

+0

你可以添加你的main.dev.ts的內容到你的文章?我猜想會有所幫助;) – OClyde

+0

@OClyde所有源代碼都來自「空白」示例項目。 – mackthehobbit

回答

0

嘗試較舊版本的ionic-app-scripts。例如,您可以強制安裝npm install [email protected]的特定版本。