无法解析类型实体i20.cdkscrollablemodule到符号NX Workspace

发布于 2025-01-18 17:53:55 字数 2891 浏览 0 评论 0原文

所以我在网上研究了此类问题,但仍然没有找到解决方案。

我尝试删除node_module,删除package-lock.json,更新所有依赖项,甚至执行nx migrate。

我在工作区项目中看到和搜索的没有两个 node_modules

npm install 工作成功,但是一旦我运行 nxserve 命令,我会收到以下错误:

./apps/app name/src/main.ts - 错误:模块构建失败(来自./node_modules/@ngtools/webpack/src/ivy/index.js): 错误:无法将类型实体 i20.CdkScrollableModule 解析为符号 在 \node_modules@ngtools\webpack\src\ivy\loader.js:77:18 在 processTicksAndRejections (internal/process/task_queues.js:93:5)

./apps/app name/src/polyfills.ts - 错误:模块构建失败(来自 ./node_modules/@ngtools/webpack /src/ivy/index.js): 错误:无法将类型实体 i20.CdkScrollableModule 解析为符号 在 \node_modules@ngtools\webpack\src\ivy\loader.js:77:18 在 processTicksAndRejections (internal/process/task_queues.js:93:5)

Package.json:

{
  "name": "nx-test",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "nx",
    "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser 
     module main",
    "start": "nx serve",
    "build": "nx build",
    "test": "nx test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.2.0",
    "@angular/common": "~13.2.0",
    "@angular/compiler": "~13.2.0",
    "@angular/core": "~13.2.0",
    "@angular/forms": "~13.2.0",
    "@angular/localize": "~13.2.0",
    "@angular/material": "^13.3.2",
    "@angular/platform-browser": "~13.2.0",
    "@angular/platform-browser-dynamic": "~13.2.0",
    "@angular/router": "~13.2.0",
    "@ngx-translate/core": "^14.0.0",
    "@ngx-translate/http-loader": "^7.0.0",
    "@nrwl/angular": "13.9.6",
    "angular-material": "^1.2.4",
    "bootstrap": "^5.1.3",
    "ng-packagr": "^13.3.0",
    "rxjs": "~7.4.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.2.0",
    "@angular-eslint/eslint-plugin": "~13.0.1",
    "@angular-eslint/eslint-plugin-template": "~13.0.1",
    "@angular-eslint/template-parser": "~13.0.1",
    "@angular/cli": "~13.2.0",
    "@angular/compiler-cli": "~13.2.0",
    "@angular/language-service": "~13.2.0",
    "@nrwl/cli": "13.9.6",
    "@nrwl/cypress": "13.9.6",
    "@nrwl/eslint-plugin-nx": "13.9.6",
    "@nrwl/jest": "13.9.6",
    "@nrwl/linter": "13.9.6",
    "@nrwl/workspace": "13.9.6",
    "@types/jest": "27.0.2",
    "@types/node": "16.11.7",
    "@typescript-eslint/eslint-plugin": "~5.10.0",
    "@typescript-eslint/parser": "~5.10.0",
    "cypress": "^9.1.0",
    "eslint": "~8.7.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "jest": "27.2.3",
    "jest-preset-angular": "11.1.1",
    "nx": "13.9.6",
    "postcss": "^8.4.5",
    "postcss-import": "^14.0.2",
    "postcss-preset-env": "^6.7.0",
    "postcss-url": "^10.1.1",
    "prettier": "^2.5.1",
    "ts-jest": "27.0.5",
    "typescript": "~4.5.2"
  }
}

So I have reserached over the internet about this type of issue and still found no solution.

I have tried to delete node_module, deleted package-lock.json, updated all dependecies and even executed nx migrate.

There is no two node_modules what I have seen and search for in my workspace project

npm install works successfully but once I run nx serve command I get this following error:

./apps/app name/src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Cannot resolve type entity i20.CdkScrollableModule to symbol
at \node_modules@ngtools\webpack\src\ivy\loader.js:77:18
at processTicksAndRejections (internal/process/task_queues.js:93:5)

./apps/app name/src/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Cannot resolve type entity i20.CdkScrollableModule to symbol
at \node_modules@ngtools\webpack\src\ivy\loader.js:77:18
at processTicksAndRejections (internal/process/task_queues.js:93:5)

Package.json:

{
  "name": "nx-test",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "nx",
    "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser 
     module main",
    "start": "nx serve",
    "build": "nx build",
    "test": "nx test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.2.0",
    "@angular/common": "~13.2.0",
    "@angular/compiler": "~13.2.0",
    "@angular/core": "~13.2.0",
    "@angular/forms": "~13.2.0",
    "@angular/localize": "~13.2.0",
    "@angular/material": "^13.3.2",
    "@angular/platform-browser": "~13.2.0",
    "@angular/platform-browser-dynamic": "~13.2.0",
    "@angular/router": "~13.2.0",
    "@ngx-translate/core": "^14.0.0",
    "@ngx-translate/http-loader": "^7.0.0",
    "@nrwl/angular": "13.9.6",
    "angular-material": "^1.2.4",
    "bootstrap": "^5.1.3",
    "ng-packagr": "^13.3.0",
    "rxjs": "~7.4.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.2.0",
    "@angular-eslint/eslint-plugin": "~13.0.1",
    "@angular-eslint/eslint-plugin-template": "~13.0.1",
    "@angular-eslint/template-parser": "~13.0.1",
    "@angular/cli": "~13.2.0",
    "@angular/compiler-cli": "~13.2.0",
    "@angular/language-service": "~13.2.0",
    "@nrwl/cli": "13.9.6",
    "@nrwl/cypress": "13.9.6",
    "@nrwl/eslint-plugin-nx": "13.9.6",
    "@nrwl/jest": "13.9.6",
    "@nrwl/linter": "13.9.6",
    "@nrwl/workspace": "13.9.6",
    "@types/jest": "27.0.2",
    "@types/node": "16.11.7",
    "@typescript-eslint/eslint-plugin": "~5.10.0",
    "@typescript-eslint/parser": "~5.10.0",
    "cypress": "^9.1.0",
    "eslint": "~8.7.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "jest": "27.2.3",
    "jest-preset-angular": "11.1.1",
    "nx": "13.9.6",
    "postcss": "^8.4.5",
    "postcss-import": "^14.0.2",
    "postcss-preset-env": "^6.7.0",
    "postcss-url": "^10.1.1",
    "prettier": "^2.5.1",
    "ts-jest": "27.0.5",
    "typescript": "~4.5.2"
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经暖 2025-01-25 17:53:55

我在NX工作区中收到了类似的错误,其中有Angular 14:

./apps/simple-examples/src/main.ts - Error: Module build failed 
(from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Cannot resolve type entity i12.PortalModule to symbol
    at C:\MyDirectory\Angular.Examples.MonoRepo\Client\node_modules\@ngtools\webpack\src\ivy\loader.js:81:18
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

我发现唯一帮助的是更新到最新版本的Angular

我确实找到了博客文章建议您要做的只是更新 @angular/core和 @angular/cli;但是,我认为是否要更新,我将仅将所有内容更新为Angular 14的最高版本。

I received a similar error in Nx workspaces with Angular 14:

./apps/simple-examples/src/main.ts - Error: Module build failed 
(from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Cannot resolve type entity i12.PortalModule to symbol
    at C:\MyDirectory\Angular.Examples.MonoRepo\Client\node_modules\@ngtools\webpack\src\ivy\loader.js:81:18
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

The only thing that I found that helped was updating to the latest version of Angular.

I did find a blog post that suggested that all you needed to do was update @angular/core and @angular/cli; however, I figured if I'm going to update, I'll just updating everything to highest version of Angular 14.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文