angular - 无法在 getRequiredModulePath 处读取 NodeObject.getText 处未定义的属性 'text'

标签 angular typescript tsc angular-compiler angular-compiler-cli

生成浏览器应用程序包时发生错误(阶段:设置)。
什么会导致此错误?
来自控制台的信息:

Generating browser application bundles (phase: setup)... TypeError: Cannot read property 'text' of undefined at NodeObject.getText (/opt/app-root/src/node_modules/typescript/lib/typescript.js:152697:31) at getRequiredModulePath (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:519:99) at Object.getImportsOfUmdModule (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:510:23) at UmdDependencyHost.extractImports (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/dependencies/umd_dependency_host.js:43:54) at UmdDependencyHost.DependencyHostBase.recursivelyCollectDependencies (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:85:32) at UmdDependencyHost.DependencyHostBase.collectDependencies (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:38:22) at DependencyResolver.getEntryPointWithDependencies (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_resolver.js:75:22) at EntryPointCollector.walkDirectoryForPackages (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/entry_point_collector.js:47:52) at EntryPointCollector.walkDirectoryForPackages (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/entry_point_collector.js:75:103) at /opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/program_based_entry_point_finder.js:124:100


来自 angular-errors.log 的信息

An error occurred during the build: Error: NGCC failed. at NgccProcessor.process (/opt/app-root/src/node_modules/@ngtools/webpack/src/ngcc_processor.js:139:19) at /opt/app-root/src/node_modules/@ngtools/webpack/src/ivy/plugin.js:129:27 at Hook.eval [as call] (eval at create (/opt/app-root/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), :28:1) at Hook.CALL_DELEGATE [as _call] (/opt/app-root/src/node_modules/tapable/lib/Hook.js:14:14) at Compiler.newCompilation (/opt/app-root/src/node_modules/webpack/lib/Compiler.js:1043:30) at /opt/app-root/src/node_modules/webpack/lib/Compiler.js:1088:29 at Hook.eval [as callAsync] (eval at create (/opt/app-root/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), :22:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/opt/app-root/src/node_modules/tapable/lib/Hook.js:18:14) at Compiler.compile (/opt/app-root/src/node_modules/webpack/lib/Compiler.js:1083:28) at /opt/app-root/src/node_modules/webpack/lib/Compiler.js:508:12 at Compiler.readRecords (/opt/app-root/src/node_modules/webpack/lib/Compiler.js:920:11) at /opt/app-root/src/node_modules/webpack/lib/Compiler.js:505:11 at Hook.eval [as callAsync] (eval at create (/opt/app-root/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), :10:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/opt/app-root/src/node_modules/tapable/lib/Hook.js:18:14) at /opt/app-root/src/node_modules/webpack/lib/Compiler.js:502:20 at Hook.eval [as callAsync] (eval at create (/opt/app-root/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), :22:1) An unhandled exception occurred: NGCC failed. See "/tmp/ng-IZbyMh/angular-errors.log" for further details.

最佳答案

Angular 版本 12.2.12 和 12.2.11 中存在错误,使用 12.2.10 它将修复它,或者您可能需要等待他们发​​布新版本或修复 12.2.12
注意:如果您在 package.json 文件中使用 ^12.0.1,请将其替换为 12.2.10

关于angular - 无法在 getRequiredModulePath 处读取 NodeObject.getText 处未定义的属性 'text',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69736513/

相关文章:

javascript - 在 div angular 7 上传递值 onclick

typescript - 加载 ng2-table 数据表单 API

javascript - 获取地理点时出现 typescript 错误,意外的 ','

angular - Ionic 3 - 如何使用默认属性禁用滚动而不溢出 :hidden

javascript - 如何根据对象值从两个数组创建一个新的对象数组?

javascript - RequireJS 模块的 TypeScript 编译生成行 Object.defineProperty(exports, "__esModule", { value : true }); How to get rid of it?

javascript - 由于使用私有(private)名称,不会发出声明

javascript - 如何连接和缩小 Angular 2 应用程序?

angular - Angular 8 中这些创建服务方法有什么区别?

typescript - 如何防止 "any"在 TypeScript 类型和接口(interface)中使用