2016-11-14 85 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]的特定版本。