我正在尝试将Angular Material添加到我的Angular 9项目中,以便可以使用自动完成功能。不幸的是,在遵循the installation guide的同时,我无法超越安装Angular Material模块的第一步。我尝试按照此stackoverflow post中列出的步骤解决问题。这是我采取的步骤,下面还有我的package.json供参考。
npm install --save @angular/material @angular/cdk @angular/animations
ng add @angular/material
这些命令的输出如下:
chantelle@penny:~/projects/nereus_bos/2020-bos-frontend/bos-frontend$ npm install @angular/material --save
npm WARN @aws-amplify/datastore@2.1.0 requires a peer of @react-native-community/netinfo@^5.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN @aws-amplify/core@2.3.0 requires a peer of @react-native-community/netinfo@^5.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ @angular/material@9.2.4
updated 1 package and audited 1729 packages in 10.141s
54 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
chantelle@penny:~/projects/nereus_bos/2020-bos-frontend/bos-frontend$ ng add @angular/material
Skipping installation: Package already installed
? Choose a prebuilt theme name, or "custom" for a custom theme: Deep Purple/Amber [ Preview: https://material.angular.io?theme=deepp
urple-amber ]
? Set up global Angular Material typography styles? No
? Set up browser animations for Angular Material? Yes
UPDATE package.json (1563 bytes)
✔ Packages installed successfully.
Cannot read property 'endTag' of null
我的package.json:
{
"name": "bos-frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^9.1.9",
"@angular/cdk": "^9.2.4",
"@angular/common": "~9.1.9",
"@angular/compiler": "~9.1.9",
"@angular/core": "~9.1.9",
"@angular/forms": "~9.1.9",
"@angular/localize": "~9.1.7",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "~9.1.9",
"@angular/platform-browser-dynamic": "~9.1.9",
"@angular/router": "~9.1.9",
"@aws-amplify/pubsub": "^2.1.1",
"@ng-bootstrap/ng-bootstrap": "^6.1.0",
"aws-amplify": "^3.0.11",
"bootstrap": "^4.5.0",
"jquery": "^3.5.1",
"ngx-spinner": "^9.0.2",
"popper.js": "^1.16.1",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.7",
"@angular/cli": "~9.1.7",
"@angular/compiler-cli": "~9.1.9",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
}
}