我有一个角度自定义库@foo/bar
,它具有以下依赖项:
"peerDependencies": {
"@angular/common": "^10.0.14",
"@angular/core": "^10.0.14"
},
"dependencies": {
"@angular/material": "11.0.1",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@custom-library-1": "^0.0.5",
"@custom-library-2": "^0.0.1",
"tslib": "^2.0.0"
},
yarn add @foo/bar
当我在一个干净的项目(只有一个空的 package.json)中安装这个库并导航到 时node_modules/@angular
,我看到了文件夹@angular/material/core
。
现在,我要删除我的node_modules
and yarn.lock
,并将以下依赖项添加到该项目中:
"dependencies": {
"@angular/animations": "9.1.11",
"@angular/common": "9.1.11",
"@angular/compiler": "9.1.11",
"@angular/core": "9.1.11",
"@angular/forms": "9.1.11",
"@angular/material-moment-adapter": "^11.0.1",
"@angular/platform-browser": "9.1.11",
"@angular/platform-browser-dynamic": "9.1.11",
"@angular/router": "9.1.11",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@ngxs/store": "^3.7.0",
"@nrwl/angular": "9.4.4",
"@custom-library-1": "^0.0.1",
"@custom-library-1": "^0.0.5",
"core-js": "^2.5.4",
"rxjs": "6.5.5",
"zone.js": "^0.9.1",
"@foo/bar": "0.0.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.901.9",
"@angular/cli": "9.1.9",
"@angular/compiler-cli": "9.1.11",
"@angular/language-service": "9.1.11",
"@biesbjerg/ngx-translate-extract": "^4.2.0",
"@nrwl/cypress": "9.4.4",
"@nrwl/jest": "9.4.4",
"@nrwl/workspace": "9.4.4",
"@types/jest": "25.1.4",
"@types/node": "~8.9.4",
"aws-sdk": "^2.585.0",
"codelyzer": "~5.0.1",
"cypress": "3.8.2",
"dotenv": "6.2.0",
"eslint": "6.8.0",
"express-serve-static-core": "^0.1.1",
"jest": "25.2.4",
"jest-preset-angular": "8.1.3",
"prettier": "2.0.4",
"readdir-enhanced": "^5.1.1",
"ts-jest": "25.2.1",
"ts-node": "~7.0.0",
"tslint": "6.0.0",
"typescript": "3.8.3"
}
现在,当我尝试构建项目时,我遇到了这个错误:
ERROR in The target entry-point "@foo/bar" has missing dependencies:
- @angular/material/core
另外,当我导航到 时node_modules/@angular
,我注意到整个@angular/material
都消失了。任何人都知道为什么以及如何解决它?