npm启动代理错误

问题描述 投票:0回答:1

[每当我为我的应用程序运行npm start时,我都会收到多个代理错误:

Proxy error: Could not proxy request /deryl/js/init.js from localhost:8080 to http://localhost:8080. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ENFILE).

Proxy error: Could not proxy request /deryl/queup/static/js/bundle.js from localhost:8080 to http://localhost:8080. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).

Proxy error: Could not proxy request /deryl/queup/static/js/main.chunk.js from localhost:8080 to http://localhost:8080. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ENFILE).

Proxy error: Could not proxy request /deryl/queup/static/js/bundle.js from localhost:8080 to http://localhost:8080. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ENFILE).

Proxy error: Could not proxy request /deryl/queu/favicon.ico from localhost:8080 to http://localhost:8080. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ENFILE).

此问题在我安装@ babel / plugin-proposal-throw-expressions的依赖项,运行npm审核修复程序(以修复漏洞),将react-script从3.3.0升级到3.4.0并运行npm安装之后开始。

这是我的package.json:

{
  "name": "queup",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "argon2": "^0.23.0",
    "argon2themax": "^1.2.0",
    "body-parser": "^1.19.0",
    "bootstrap": "^4.4.1",
    "isomorphic-ws": "^4.0.1",
    "mongoose": "^5.6.2",
    "nodemailer": "^6.3.0",
    "react": "^16.8.6",
    "react-bootstrap": "^1.0.0-beta.16",
    "react-burger-menu": "^2.6.10",
    "react-dom": "^16.8.6",
    "react-responsive": "^6.1.2",
    "react-router-dom": "^5.0.0",
    "react-scripts": "^3.4.0",
    "sweetalert2": "^8.11.7",
    "ws": "^7.1.2"
  },
  "scripts": {
    "start": "PORT=8080 react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "proxy": "http://localhost:8080",
  "description": "Routes",
  "main": "server.js",
  "repository": {
    "type": "git",
    "url": "git+https://gitlab.com/deryl/queup.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://gitlab.com/deryl/queup/issues"
  },
  "homepage": "https://gitlab.com/deryl/queup#readme",
  "devDependencies": {
    "@types/express": "^4.17.1",
    "@types/ws": "^6.0.3",
    "typescript": "^3.6.3"
  }
}
reactjs npm npm-scripts npm-start
1个回答
0
投票

代理(8080)的端口号与npm启动脚本(8080)的端口号相同。这可能是导致错误的原因。

npm start通常在port#3000上运行。proxy设置指定将由npm用作代理的外部Web服务。

代理不能与npm脚本在同一端口上运行。

更改npm start或代理的端口号可以解决此问题。

© www.soinside.com 2019 - 2024. All rights reserved.