1

我的应用程序在使用时构建和运行良好,ng serve但在使用ng build --prod. 该错误在依赖项下,/node_modules/因此不确定如何解决此问题?

在此处输入图像描述

错误信息:

ERROR in Unexpected value 'undefined' imported by the module 'ExampleModule in /Users/Projects/KagiDocs/git/core/node_modules/@angular/material-examples/examples_public_index.d.ts'

包.json

...
"private": true,
"dependencies": {
  "@angular/animations": "^8.0.0",
  "@angular/cdk": "^8.1.4",
  "@angular/cdk-experimental": "^8.1.1",
  "@angular/common": "^8.0.0",
  "@angular/compiler": "^8.0.0",
  "@angular/core": "^8.0.0",
  "@angular/forms": "^8.0.0",
  "@angular/material": "^8.1.4",
  "@angular/material-examples": "angular/material2-docs-content#8.1.x",
  "@angular/material-experimental": "^8.1.1",
  "@angular/material-moment-adapter": "^8.1.4",
  "@angular/platform-browser": "^8.0.0",
  "@angular/platform-browser-dynamic": "^8.0.0",
  "@angular/router": "^8.0.0",
  "core-js": "^2.6.1",
  "hammerjs": "^2.0.8",
  "material-components-web": "^1.1.1",
  "moment": "^2.23.0",
  "rxjs": "^6.5.1",
  "zone.js": "^0.9.0"
},
"devDependencies": {
  "@angular-devkit/build-angular": "^0.800.0",
  "@angular/cli": "^8.0.0",
  "@angular/compiler-cli": "^8.0.0",
  "@types/jasmine": "^3.3.5",
  "@types/node": "^10.12.18",
  "firebase-tools": "^6.2.2",
  "jasmine-core": "~2.99.1",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "^3.1.4",
  "karma-chrome-launcher": "^2.2.0",
  "karma-firefox-launcher": "^1.1.0",
  "karma-jasmine": "^1.1.2",
  "karma-jasmine-html-reporter": "^0.2.2",
  "node-sass": "^4.11.0",
  "protractor": "~5.3.0",
  "ts-node": "^6.0.3",
  "tslint": "^5.10.0",
  "typescript": "3.4"
  } 
 }

我们已经 。克隆了这个https://github.com/angular/material.angular.io代码库来构建我们的项目。

4

1 回答 1

1

我们能够解决问题,发布解决方案以供参考:

按照https://github.com/angular/material.angular.io/issues/629angular/material2-docs-content中的建议,将in的版本更新package.json

"@angular/material-examples": "angular/material2-docs-content#8.0.x",

修复了这个问题。

使用时有问题:

"@angular/material-examples": "angular/material2-docs-content#8.1.x",
于 2019-09-26T17:22:58.110 回答