【问题标题】:ERROR in ./node_modules/@angular/material/esm2015/select.js./node_modules/@angular/material/esm2015/select.js 中的错误
【发布时间】:2021-05-30 20:44:54
【问题描述】:

请帮忙,因为我在将我的全局 @angular/cli 升级到版本 11 后遇到错误。我已经恢复到版本 8。但是现在当我尝试编译时,这个错误仍然出现。我怀疑是版本兼容性或垫角问题。我已经尝试删除节点模块并使用npm install 重新安装。我也尝试使用 npm cache clean 但仍然没有结果。我已遵循此post 的建议。但是错误仍然发生。请指教。

fail: Microsoft.AspNetCore.SpaServices[0]
      ERROR in ./node_modules/@angular/material/esm2015/select.js 104:4-33
"export '╔╡╔╡classMapInterpolate1' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/material/esm2015/stepper.js 368:8-37
"export '╔╡╔╡classMapInterpolate1' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/material/esm2015/table.js 84:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/material/esm2015/table.js 85:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/material/esm2015/table.js 86:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/material/esm2015/table.js 344:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/material/esm2015/table.js 371:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/material/esm2015/table.js 398:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/material/esm2015/tree.js 305:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/cdk/esm2015/table.js 621:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/cdk/esm2015/table.js 645:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/cdk/esm2015/table.js 669:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/cdk/esm2015/table.js 2215:8-33
"export '╔╡╔╡elementContainer' (imported as '╔╡ngcc0') was not found in '@angular/core'
ERROR in ./node_modules/@angular/cdk/esm2015/table.js 2216:8-33

以下是我的全局 Angular cli 版本

Angular CLI: 8.3.21
Node: 12.16.3
OS: win32 x64
Angular: 8.1.3
... common, core, language-service, service-worker

Package                             Version
-------------------------------------------------------------
@angular-devkit/architect           0.803.21
@angular-devkit/build-angular       0.803.21
@angular-devkit/build-optimizer     0.803.21
@angular-devkit/build-webpack       0.803.21
@angular-devkit/core                8.3.6
@angular-devkit/schematics          8.3.21
@angular/animations                 8.2.14
@angular/cdk                        8.2.3
@angular/cli                        8.3.21
@angular/compiler                   8.2.8
@angular/compiler-cli               8.2.8
@angular/flex-layout                7.0.0-beta.24
@angular/forms                      8.2.8
@angular/http                       7.2.15
@angular/material                   8.2.3
@angular/material-moment-adapter    8.2.3
@angular/platform-browser           8.1.0
@angular/platform-browser-dynamic   8.2.8
@angular/pwa                        0.803.21
@angular/router                     8.2.8
@ngtools/webpack                    8.3.21
@schematics/angular                 8.3.21
@schematics/update                  0.803.21
rxjs                                6.5.4
typescript                          3.4.5
webpack                             4.39.2

这是我的本地节点模块

{
  "name": "ec.inventory.api",
  "version": "1.1.179",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "prebuild": "npm version patch",
    "build": "ng build --aot",
    "build:ssr": "ng run EC.Inventory.API:server:dev",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/core": "8.3.6",
    "@angular/animations": "^8.2.14",
    "@angular/cdk": "8.2.3",
    "@angular/cli": "^8.3.21",
    "@angular/common": "8.1.3",
    "@angular/compiler": "8.2.8",
    "@angular/core": "8.1.3",
    "@angular/flex-layout": "^7.0.0-beta.19",
    "@angular/forms": "8.2.8",
    "@angular/http": "^7.2.15",
    "@angular/material": "^8.2.3",
    "@angular/material-moment-adapter": "^8.2.3",
    "@angular/platform-browser": "8.1.0",
    "@angular/platform-browser-dynamic": "8.2.8",
    "@angular/pwa": "^0.803.21",
    "@angular/router": "8.2.8",
    "@angular/service-worker": "8.1.3",
    "@aspnet/signalr": "^3.0.0-preview6.19307.2",
    "@covalent/core": "^2.1.1",
    "@kolkov/angular-editor": "^1.1.1",
    "@ng-bootstrap/ng-bootstrap": "^5.1.0",
    "angular-bootstrap-md": "^8.1.1",
    "angular2-jwt": "^0.2.3",
    "angular2-signaturepad": "^2.11.0",
    "bootstrap": "4.3.1",
    "bootstrap-material-design": "4.1.2",
    "bootstrap-notify": "3.1.3",
    "core-js": "^2.6.11",
    "crypto-js": "^3.1.9-1",
    "date-fns": "^2.8.1",
    "fingerprintjs2": "^1.8.1",
    "hammerjs": "^2.0.8",
    "moment": "^2.24.0",
    "ng-lottie": "^0.3.2",
    "ng-pick-datetime": "^7.0.0",
    "ng-simple-google-login": "0.0.2",
    "ng2-charts": "^2.3.0",
    "ng2-pdf-viewer": "^5.3.4",
    "ngx-barcode": "^0.2.4",
    "ngx-mask": "^8.1.7",
    "node-sass": "^4.12.0",
    "rxjs": "^6.5.4",
    "rxjs-compat": "^6.5.4",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.21",
    "@angular/compiler-cli": "8.2.8",
    "@angular/language-service": "8.1.3",
    "@types/bootstrap": "4.3.0",
    "@types/chartist": "^0.9.37",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "^2.0.8",
    "@types/jquery": "^3.3.22",
    "@types/node": "^6.0.118",
    "codelyzer": "^5.2.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "3.4.5"
  },
  "optionalDependencies": {
    "node-sass": "^4.9.3",
    "protractor": "~5.4.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1"
  }
}

按照建议尝试命令

npm install -S @angular/material @angular/cdk @angular/animations

npm uninstall @angular/core

npm install -S @angular/core

但在安装时显示以下错误

$ npm install -S @angular/material @angular/cdk @angular/animations
npm WARN @angular/flex-layout@7.0.0-beta.24 requires a peer of @angular/cdk@^7.0.0-rc.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@8.2.8 requires a peer of @angular/core@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@8.2.8 requires a peer of @angular/common@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@8.2.8 requires a peer of @angular/platform-browser@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@7.2.16 requires a peer of @angular/core@7.2.16 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/http@7.2.16 requires a peer of @angular/platform-browser@7.2.16 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser@8.1.0 requires a peer of @angular/core@8.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser@8.1.0 requires a peer of @angular/common@8.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser-dynamic@8.2.8 requires a peer of @angular/core@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser-dynamic@8.2.8 requires a peer of @angular/common@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/platform-browser-dynamic@8.2.8 requires a peer of @angular/platform-browser@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@8.2.8 requires a peer of @angular/core@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@8.2.8 requires a peer of @angular/common@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@8.2.8 requires a peer of @angular/platform-browser@8.2.8 but none is installed. You must install peer dependencies yourself.
npm WARN @covalent/core@2.1.1 requires a peer of @angular/common@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @covalent/core@2.1.1 requires a peer of @angular/core@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @covalent/core@2.1.1 requires a peer of @angular/forms@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @covalent/core@2.1.1 requires a peer of @angular/router@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @covalent/core@2.1.1 requires a peer of @angular/cdk@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @covalent/core@2.1.1 requires a peer of @angular/material@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular2-jwt@0.2.3 requires a peer of @angular/core@^2.0.0||^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular2-jwt@0.2.3 requires a peer of @angular/http@^2.0.0||^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular2-jwt@0.2.3 requires a peer of rxjs@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN ng-pick-datetime@7.0.0 requires a peer of @angular/cdk@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng-simple-google-login@0.0.2 requires a peer of @angular/common@^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN ng-simple-google-login@0.0.2 requires a peer of @angular/core@^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-charts@2.4.2 requires a peer of chart.js@^2.9.3 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-barcode@0.2.4 requires a peer of @angular/core@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-barcode@0.2.4 requires a peer of rxjs@^5.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-barcode@0.2.4 requires a peer of zone.js@^0.8.4 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/animations@8.2.14 requires a peer of @angular/core@8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN The package protractor is included as both a dev and production dependency.
npm WARN The package ts-node is included as both a dev and production dependency.
npm WARN The package tslint is included as both a dev and production dependency.

npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\shawn\Desktop\BP_eClinic\EC.Inventory.API\ClientApp\node_modules\@angular\material\typings
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\shawn\Desktop\BP_eClinic\EC.Inventory.API\ClientApp\node_modules\@angular\material\typings'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\shawn\Desktop\BP_eClinic\EC.Inventory.API\ClientApp\node_modules\@angular\material\typings'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\shawn\Desktop\BP_eClinic\EC.Inventory.API\ClientApp\node_modules\@angular\material\typings'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'C:\\Users\\shawn\\Desktop\\BP_eClinic\\EC.Inventory.API\\ClientApp\\node_modules\\@angular\\material\\typings'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Users\\shawn\\Desktop\\BP_eClinic\\EC.Inventory.API\\ClientApp\\node_modules\\@angular\\material\\typings',
npm ERR!   parent: 'ClientApp'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

【问题讨论】:

    标签: angular


    【解决方案1】:

    经过几天的故障排除,我终于找出了问题所在。 Angular Service Language Service 使用的是与 Angular 8 不兼容的 Ivy 语言服务。我需要做的只是取消勾选启用 Ivy 语言服务并重新启动 Visual Studio 代码。之后,问题就解决了。

    【讨论】:

      【解决方案2】:

      试试这是否可行:

      npm install -S @angular/material @angular/cdk @angular/animations
      
      npm uninstall @angular/core
      
      npm install -S @angular/core
      

      更新帖子:

      试试这是否可行:

      • 卸载 NodeJs

      • 从 AppData/Roaming 中删除文件夹“npm”和“npm-cache”

      • 停用防火墙和所有防病毒软件(包括 Windows Defender)

      • 重启系统

      • 以管理员身份打开命令提示符并执行“npm install”

      或者这个:

       npm cache clean --force  
      
       npm install npm@latest -g
      

      【讨论】:

      • 感谢您的建议。我尝试了该命令,但安装时出错。我已经更新了问题中的错误。
      • 看来我的问题和这个github.com/vmware/clarity/issues/5041一样。任何人都可以解释问题的原因是什么?
      • 尝试所有建议后出现同样的错误
      • 用另一件事更新了帖子,如果它不起作用我不知道..
      猜你喜欢
      • 2021-01-12
      • 2021-08-13
      • 2021-02-10
      • 2019-10-02
      • 2020-07-25
      • 2021-12-30
      • 1970-01-01
      • 2018-11-16
      相关资源
      最近更新 更多