Angular/material 更新到 9.2.4 后崩溃
Angular/material crash after update to 9.2.4
今天我已经将 Angular/material 从 9.2.0-next 更新到 9.2.4,在 ng serve 之后我得到了这个:
platform.js:78 Uncaught TypeError: Class constructor Platform cannot be invoked without 'new'
at Module../node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/platform.js (platform.js:78)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/a11y.js (a11y.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/material/__ivy_ngcc__/fesm2015/core.js (core.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/material/__ivy_ngcc__/fesm2015/icon.js (icon.js:1)
at __webpack_require__ (bootstrap:84)
at Module../src/app/home/home.component.ts (home.component.ts:1)
at __webpack_require__ (bootstrap:84)
已尝试删除 node_modules 文件夹并重新安装,我该怎么办?
ng --version
Angular CLI: 9.1.8 Node: 12.8.1 OS: win32 x64
Angular: 9.1.11 ... animations, common, compiler, compiler-cli, core, forms ... language-service, localize, platform-browser ... platform-browser-dynamic, router, service-worker Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.901.8
@angular-devkit/build-angular 0.901.8
@angular-devkit/build-optimizer 0.901.8
@angular-devkit/build-webpack 0.901.8
@angular-devkit/core 9.1.8
@angular-devkit/schematics 9.1.8
@angular/cdk 10.0.0-rc.1-sha-a3dabc93d
@angular/cli 9.1.8
@angular/material 9.2.4
@angular/material-moment-adapter 9.2.4
@ngtools/webpack 9.1.8
@schematics/angular 9.1.8
@schematics/update 0.901.8
rxjs 6.5.5
typescript 3.7.5
webpack 4.42.0
ts.config
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"allowSyntheticDefaultImports": true
}
}
ts.config.app
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts"
]
}
也通过将 @angular/cdk 更新为 9.2.4 来解决(它被卡在 github:angular/cdk-builds),然后用干净的 npm i
重新安装了所有东西
今天我已经将 Angular/material 从 9.2.0-next 更新到 9.2.4,在 ng serve 之后我得到了这个:
platform.js:78 Uncaught TypeError: Class constructor Platform cannot be invoked without 'new'
at Module../node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/platform.js (platform.js:78)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/cdk/__ivy_ngcc__/fesm2015/a11y.js (a11y.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/material/__ivy_ngcc__/fesm2015/core.js (core.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@angular/material/__ivy_ngcc__/fesm2015/icon.js (icon.js:1)
at __webpack_require__ (bootstrap:84)
at Module../src/app/home/home.component.ts (home.component.ts:1)
at __webpack_require__ (bootstrap:84)
已尝试删除 node_modules 文件夹并重新安装,我该怎么办?
ng --version
Angular CLI: 9.1.8 Node: 12.8.1 OS: win32 x64
Angular: 9.1.11 ... animations, common, compiler, compiler-cli, core, forms ... language-service, localize, platform-browser ... platform-browser-dynamic, router, service-worker Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.901.8
@angular-devkit/build-angular 0.901.8
@angular-devkit/build-optimizer 0.901.8
@angular-devkit/build-webpack 0.901.8
@angular-devkit/core 9.1.8
@angular-devkit/schematics 9.1.8
@angular/cdk 10.0.0-rc.1-sha-a3dabc93d
@angular/cli 9.1.8
@angular/material 9.2.4
@angular/material-moment-adapter 9.2.4
@ngtools/webpack 9.1.8
@schematics/angular 9.1.8
@schematics/update 0.901.8
rxjs 6.5.5
typescript 3.7.5
webpack 4.42.0
ts.config
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"allowSyntheticDefaultImports": true
}
}
ts.config.app
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"exclude": [
"src/test.ts",
"src/**/*.spec.ts"
]
}
也通过将 @angular/cdk 更新为 9.2.4 来解决(它被卡在 github:angular/cdk-builds),然后用干净的 npm i