当我执行ng serve -o时,发生未处理的异常:ts.createNodeArray不是函数

时间:2019-08-21 06:27:24

标签: angular exception unhandled

我在做ng serve -o时(在Angular 6中)收到此错误

An unhandled exception occurred: ts.createNodeArray is not a function
See "C:\Users\MADHUK~1.PUL\AppData\Local\Temp\ng-V81Kkf\angular-errors.log" for further details.

当我打开该文件时,它显示如下

[error] TypeError: ts.createNodeArray is not a function
    at C:\Users\madhukar.pul\Desktop\Angular\employee\node_modules\@angular\compiler-cli\src\metadata\evaluator.js:670:20
    at C:\Users\madhukar.pul\Desktop\Angular\employee\node_modules\@angular\compiler-cli\src\metadata\evaluator.js:10:17
    at Object.<anonymous> (C:\Users\madhukar.pul\Desktop\Angular\employee\node_modules\@angular\compiler-cli\src\metadata\evaluator.js:16:3)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at C:\Users\madhukar.pul\Desktop\Angular\employee\node_modules\@angular\compiler-cli\src\metadata\collector.js:21:23
    at C:\Users\madhukar.pul\Desktop\Angular\employee\node_modules\@angular\compiler-cli\src\metadata\collector.js:10:17
    at Object.<anonymous> (C:\Users\madhukar.pul\Desktop\Angular\employee\node_modules\@angular\compiler-cli\src\metadata\collector.js:16:3)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

1 个答案:

答案 0 :(得分:0)

要尝试的步骤:-

  1. 重新安装node_modules。

  2. 检查节点和打字稿版本。可能是您需要更新节点或打字稿版本。

希望这会有所帮助。