使用 ng gc my-component 创建组件时出现以下错误
'发生未处理的异常:catch 子句变量不是错误实例, 请参阅“path-to-file\angular-errors.log”了解更多详细信息。
并且文件包含以下堆栈跟踪: [错误] AssertionError [ERR_ASSERTION]:catch 子句变量不是assertIsError 处的错误实例(C:\Users\sam\node_modules@angular\cli\src\utilities\error.js:16:26 )在GenerateCommandModule.runSchematic (C:\Users\sam\node_modules@angular\cli\src\command-builder\schematics-command-module.js:311:43) 在异步GenerateCommandModule.handler (C:\Users\sam\ node_modules@angular\cli\src\command-builder\command-module.js:109:24)
即使更新 Angular cli 后也没有运气
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
npm cache verify
npm install -g @angular/cli@latest
Run Code Online (Sandbox Code Playgroud)
下面是我的package.json文件:
{
"name": "my-sample-frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^14.1.0",
"@angular/common": "^14.1.0",
"@angular/compiler": "^14.1.0",
"@angular/core": "^14.1.0",
"@angular/forms": …Run Code Online (Sandbox Code Playgroud)