简体   繁体   English

无法解析模块@angular/core 中的错误

[英]ERROR in Could not resolve module @angular/core

In a process of migration from webpack2 to webpack4 and from Angular4 to Angular5 I'm getting strange error for webpack compilation (./node_modules/.bin/webpack-cli):在从webpack2迁移到webpack4和Angular4到Angular5我的过程我得到奇怪的错误的WebPack汇编(./node_modules/.bin/webpack-cli):

ERROR in Could not resolve module @angular/core无法解析模块@angular/core 中的错误

Debugging webpack ( node --inspect-brk ./node_modules/.bin/webpack-cli ) got an error stack trace:调试 webpack ( node --inspect-brk ./node_modules/.bin/webpack-cli ) 得到一个错误堆栈跟踪:

Error: Could not resolve module @angular/core
    at StaticSymbolResolver.getSymbolByModule (.../node_modules/@angular/compiler/bundles/compiler.umd.js:29766:30)
    at StaticReflector.findDeclaration (.../node_modules/@angular/compiler/bundles/compiler.umd.js:31635:63)
    at StaticReflector.initializeConversionMap (.../node_modules/@angular/compiler/bundles/compiler.umd.js:31953:36)
    at new StaticReflector (.../node_modules/@angular/compiler/bundles/compiler.umd.js:31571:14)
    at Object.createAotCompiler (.../node_modules/@angular/compiler/bundles/compiler.umd.js:32957:44)
    at AngularCompilerProgram._createCompiler (.../node_modules/@angular/compiler-cli/src/transformers/program.js:404:37)
    at AngularCompilerProgram.get [as hostAdapter] (.../node_modules/@angular/compiler-cli/src/transformers/program.js:327:22)
    at AngularCompilerProgram._createProgramWithBasicStubs (.../node_modules/@angular/compiler-cli/src/transformers/program.js:435:73)
    at .../node_modules/@angular/compiler-cli/src/transformers/program.js:143:28
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:684:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:613:3

But unfortunately it still does not give a hint.但不幸的是,它仍然没有给出提示。

Here is package.json dependancies .这是package.json 依赖项

Reported this issue on angular repo.在 angular repo报告了这个问题

我实际上安装模块@angular-devkit/core解决了这个问题

Just ran into this today using Angular 10. This message continued even after a clean install今天刚刚使用 Angular 10 遇到了这个问题。即使在全新安装后,这条消息仍然存在

npm ci
ng build
ERROR in Could not resolve module @angular/core

We were working on a library install at the time, updating the library and installing new versions each new update.当时我们正在安装库,更新库并在每次更新时安装新版本。 The root cause of this issue was that an NPM Uninstall of that library somehow didn't tell webpack the information.这个问题的根本原因是该库的 NPM 卸载不知何故没有告诉 webpack 信息。 (or perhaps we just removed the lib entry in package.json). (或者我们可能只是删除了 package.json 中的 lib 条目)。 Thus the build failure wasn't really @angular/core it was that web pack could not find our library to install.因此,构建失败并不是真正的@angular/core,而是 webpack 找不到我们要安装的库。

The fix: We re-installed our library again.修复:我们再次重新安装了我们的库。

npm install libName // which put a new entry into package.json

It's a known fact that webpack error messages are the worst, they tell us nothing as to who, where or why... How do we know this was a web-pack compile time error message?众所周知,webpack 错误消息是最糟糕的,它们没有告诉我们是谁、在哪里或为什么......我们怎么知道这是一个 webpack 编译时错误消息?

Generating ES5 bundles for differential loading...  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:无法解析模块@angular/core - Error: Could not resolve module @angular/core 错误在运行应用程序时无法解析模块@angular/core 错误 - ERROR in Could not resolve module @angular/core error while run app npm / angular issue:无法解析模块@ angular / core - npm / angular issue: Could not resolve module @angular/core 无法解析相对于“ ”Angular 7 的模块“ ” - Could not resolve module ' ' relative to ' ' Angular 7 找不到模块:错误:无法解析&#39;@ angular / core&#39; - Module not found: Error: Can't resolve '@angular/core' Angular 中的 tns-core-modules 突然模块解析错误 - Sudden module resolve error with tns-core-modules in Angular HostResourceResolver 中的错误:无法在 angular 中解析 - ERROR in HostResourceResolver: could not resolve in angular 无法从“ /control-panel/src/app/core/core.module.ts”解析“ ./homemodule/home.module” - ERROR in Could not resolve “./homemodule/home.module” from “/control-panel/src/app/core/core.module.ts” ng服务出错“无法解析模块” - Error in ng serve “Could not resolve module” ERROR in无法解析模块@ angular / router / src / router_config_loader - ERROR in Could not resolve module @angular/router/src/router_config_loader
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM