[英]Error when trying to serve angular application using ng serve
I created an angular application and it was working fine.我创建了一个 angular 应用程序,它运行良好。 I tried to add angular/material to my project and then my project started throwing errors.
我尝试将角度/材质添加到我的项目中,然后我的项目开始抛出错误。 I tried fixing it by searching each error, but errors keep on changing and it doesn't come to end.
我尝试通过搜索每个错误来修复它,但是错误不断变化并且它不会结束。 Fixes I tried.
我尝试过的修复。
And now it is difficult for me to find what is causing issue.现在我很难找到导致问题的原因。
Now I am getting below error, when trying ng serve现在我在尝试 ng serve 时遇到错误
[error] TypeError: readConfiguration is not a function
at readTsconfig (<solutionpath>\node_modules\@angular-devkit\build-angular\src\utils\read-tsconfig.js:45:26)
at async configureI18nBuild (\node_modules\@angular-devkit\build-angular\src\utils\i18n-options.js:124:22)
at async generateI18nBrowserWebpackConfigFromContext (\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:68:36)
at async setup (\node_modules\@angular-devkit\build-angular\src\builders\dev-server\index.js:127:47)
Please suggest me a way to fix this out.请建议我解决此问题的方法。
PFB my package.json PFB 我的 package.json
{
"name": "medicine-store-ui",
"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": "~13.1.0",
"@angular/cdk": "^13.1.0",
"@angular/common": "~13.1.0",
"@angular/compiler": "~11.1.0",
"@angular/core": "~13.1.0",
"@angular/forms": "~13.1.0",
"@angular/material": "^13.1.0",
"@angular/platform-browser": "~11.1.0",
"@angular/platform-browser-dynamic": "~11.1.0",
"@angular/router": "~11.1.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^13.1.1",
"@angular/cli": "~11.1.1",
"@angular/compiler-cli": "~11.1.0",
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "^6.3.9",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.1.2"
}
}
I faced the similar problem, Updating the cli to latest worked for me我遇到了类似的问题,将 cli 更新到最新版本对我有用
ng update @angular/compiler-cli --force ng update @angular/compiler-cli --force
First, you have to check the version of each package.首先,您必须检查每个 package 的版本。 For Node, NPM, Angular, RxJS, TypeScript, etc.
对于节点,NPM、Angular、RxJS、Z558B544CF685F39D34E7603E39C38等。
Follow the steps if you mess up with versions:如果您弄乱了版本,请按照以下步骤操作:
Step 1: Check this first for node tsLib, rxjs, and version.第 1 步:首先检查节点 tsLib、rxjs 和版本。 https://unpkg.com/browse/@angular/core@13.1.0/package.json
https://unpkg.com/browse/@angular/core@13.1.0/package.json
Also, check the angular update guideline on https://update.angular.io/此外,请查看https://update.angular.io/上的 angular 更新指南
Step 2: Check version conflicts Run this command npm outdated > versionchecks.log
第二步:检查版本冲突运行这个命令
npm outdated > versionchecks.log
Step 3: Find the relevant version angular project on GitHub.第三步:在GitHub上找到相关版本的angular工程。 you will know how others write their package.json for your angular version.
您将知道其他人如何为您的 angular 版本编写 package.json。
Example: https://github.com/search?q=%22%40angular%2Fcore%22%3A+%22~13.1.0%22%2C+extension%3Ajson+filename%3Apackage.json+language%3AJSON+language%3AJSON&type=Code示例: https://github.com/search?q=%22%40angular%2Fcore%22%3A+%22~13.1.0%22%2C+extension%3Ajson+filename%3Apackage.json+language%3AJSON+language %3AJSON&type=代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.