2016-12-15 31 views
4

padmavathi @ K1037 C:\ Users \用戶padmavathi \下載\照排機發展\網絡\儀表打字稿錯誤:無法讀取的未定義的屬性 '長' 在運行NG-服務

ng serve Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at createSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8980:109) at parseSourceFileWorker (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8940:26) at Object.parseSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8899:26) at Object.createSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8727:29) at new TypeScriptFileRefactor (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\refactor.js:25:35) at Object.resolveEntryModuleFromMain (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\entry_resolver.js:108:18) at AotPlugin._setupOptions (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\plugin.js:129:58) at new AotPlugin (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\plugin.js:37:14) at Object.exports.getWebpackNonAotConfigPartial (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\angular-cli\models\webpack-build-typescript.js:20:13) at new NgCliWebpackConfig (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\angular-cli\models\webpack-config.js:23:42) at Class.run (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\angular-cli\tasks\serve-webpack.js:20:22) at C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\angular-cli\commands\serve.js:102:26 at process._tickCallback (internal/process/next_tick.js:103:7)

+0

嗨Elluru,這看起來像一個與你的代碼無關的bug。嘗試谷歌搜索「無法讀取屬性'長度未定義在createSourceFile」 – 2016-12-15 07:04:13

+0

包括您的代碼 – Beginner

回答

1

我有同樣的錯誤。 事實證明,我在我的angular-cli.json文件中犯了一個錯誤。

{ 
    "project": { 
    "version": "1.0.0-beta.22-1", 
    "name": "angular3" 
    }, 
    "apps": [ 
    { 
     "root": "src",/* This must point to your source file locations*/ 
     "outDir": "dist",/* your output folder */ 

如果源文件夾沒有找到/可讀或者沒有找到源文件,那麼文件的長度是未定義的。

相關問題