我最近更新了我的angular-14应用程序到angular 15,我也把Node从16.17.0升级到了18.10.0。
我已经运行了npm install
和npm start
,当我的应用发送http请求时,我收到错误:
[webpack-dev-server] [HPM]将请求本地主机4200/API/医生/代理到[后端服务器]时出错[ETIMEDOUT](https://nodejs.org/api/errors.html#errors_common_system_errors)
我正在使用一个代理来调用我的API,在迁移之前它运行良好:
{
"/api": {
"target": "[backend_server]",
"secure": true,
"changeOrigin": true
}
}
这是我的包裹json:
{
"dependencies": {
"@angular/animations": "^15.0.0",
"@angular/cdk": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/forms": "^15.0.0",
"@angular/material": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.0",
"@angular/cli": "~15.0.0",
"@angular/compiler-cli": "^15.0.0",
"@types/jasmine": "~4.0.0",
"jasmine-core": "~4.3.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.8.4"
}
}
和我的棱角。
{
"projects": {
"app": {
"architect": {
"build": {...},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "app:build:production"
},
"development": {
"browserTarget": "app:build:development"
}
},
"defaultConfiguration": "development",
"options": {
"proxyConfig": "src/proxy.conf.json"
}
},
"test": {...}
}
}
}
}
我在应用迁移过程中错过了什么吗?
该问题出现在Windows和Linux上,将节点迁移回v16.17.0后,该问题不再出现。
1条答案
按热度按时间cu6pst1q1#
将代理配置从localhost更新到127.0.0.1为我们修复了这个问题。