【问题标题】:Typescript Error:Cannot read property 'length' of undefined while running ng-serve [duplicate]打字稿错误:运行 ng-serve 时无法读取未定义的属性“长度”[重复]
【发布时间】:2017-04-30 16:53:38
【问题描述】:

padmavathi@K1037 C:\Users\padmavathi\Downloads\phototype-development\web\dashboard

服务 无法读取未定义的属性“长度” TypeError:无法读取未定义的属性“长度” 在 createSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8980:109) 在 parseSourceFileWorker (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8940:26) 在 Object.parseSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8899:26) 在 Object.createSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8727:29) 在新的 TypeScriptFileRefactor (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\refactor.js:25:35) 在 Object.resolveEntryModuleFromMain (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\entry_resolver.js:108:18) 在 AotPlugin._setupOptions (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\plugin.js:129:58) 在新的 AotPlugin (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\plugin.js:37:14) 在 Object.exports.getWebpackNonAotConfigPartial (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\angular-cli\models\webpack-build-typescript.js:20:13) 在新的 NgCliWebpackConfig (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\angular-cli\models\webpack-config.js:23:42) 在 Class.run (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\angular-cli\tasks\serve-webpack.js:20:22) 在 C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\angular-cli\commands\serve.js:102:26 在 process._tickCallback (internal/process/next_tick.js:103:7)

【问题讨论】:

  • 您好 Elluru,这看起来像是一个与您的代码无关的错误。尝试谷歌搜索“无法读取 createSourceFile 处未定义的属性‘长度’”
  • 包含您的代码

标签: node.js angular typescript angular-cli


【解决方案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 */

如果未找到/读取源文件夹或未找到源文件,则文件长度未定义。

【讨论】:

    猜你喜欢
    • 2020-01-24
    • 2018-10-26
    • 2017-04-29
    • 2019-06-27
    • 1970-01-01
    • 2021-10-18
    • 1970-01-01
    • 2017-12-26
    • 1970-01-01
    相关资源
    最近更新 更多