我开始了一个关于angular的教程(我是一个React开发),我只是创建了一个新的项目与“ng新的我的第一个应用程序”。事情是,热模块重新加载由于某种原因停止工作后,我开始修改,例如“app-component.html”与各种随机文本内的html元素ex“<h1>你好dsdhs shdsd {{title}}</h1>”我不知道为什么,然后我必须执行code.exe +c并重新运行,以查看最新的更改。在终端中,我可以看到“reloading client”,当发生这种情况时:未更改的输出文件:2应用程序包生成完成。[0.112秒]正在重新启动客户端...
这可能是与angular的v17相关的问题吗?如果是的话,那么我如何轻松地将所有与angular相关的依赖项降级到v16?
更多信息:
- 我正在使用node v20.9.0和npm v10.2.3
- 请检查包裹.json:
{
"name": "my-first-app",
"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": "^17.0.0",
"@angular/common": "^17.0.0",
"@angular/compiler": "^17.0.0",
"@angular/core": "^17.0.0",
"@angular/forms": "^17.0.0",
"@angular/platform-browser": "^17.0.0",
"@angular/platform-browser-dynamic": "^17.0.0",
"@angular/router": "^17.0.0",
"rxjs": "\~7.8.0",
"tslib": "^2.3.0",
"zone.js": "\~0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.0.0",
"@angular/cli": "^17.0.0",
"@angular/compiler-cli": "^17.0.0",
"@types/jasmine": "\~5.1.0",
"jasmine-core": "\~5.1.0",
"karma": "\~6.4.0",
"karma-chrome-launcher": "\~3.2.0",
"karma-coverage": "\~2.2.0",
"karma-jasmine": "\~5.1.0",
"karma-jasmine-html-reporter": "\~2.1.0",
"typescript": "\~5.2.2"
}
}
字符串
下面是tslog.json文件:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"useDefineForClassFields": false,
"lib": \[
"ES2022",
"dom"
\]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
型
在此先谢谢您!
1条答案
按热度按时间mqkwyuun1#
这似乎是一个Angular 版本问题,有待修复,降级到以前的版本(16.2.0)没有重现同样的问题。