Node.js 在Chrome上返回405(方法不允许)的POST请求

Node.js 在Chrome上返回405(方法不允许)的POST请求,node.js,express,vue.js,axios,Node.js,Express,Vue.js,Axios,我不能从我的开发环境发送post请求,而在生产环境中,一切都能完美工作(Heroku)。我可以使用邮递员发送,没有任何问题,但前端无法到达。 这里是一个屏幕截图 Form.vue <template> <form @submit.prevent="handleSubmit" class="contact-form"> <div class="sign-up"> <h2 class="form-header">SIGN UP&

我不能从我的开发环境发送post请求,而在生产环境中,一切都能完美工作(Heroku)。我可以使用邮递员发送,没有任何问题,但前端无法到达。 这里是一个屏幕截图

Form.vue

<template>
  <form @submit.prevent="handleSubmit" class="contact-form">
    <div class="sign-up">
      <h2 class="form-header">SIGN UP</h2>
      <input type="text" id="name" placeholder="Enter Name" maxlength="20" />
      <input type="text" id="email" placeholder="Email" />
      <input type="password" id="password" placeholder="Password" />
      <button class="form-btn">SIGN UP</button>
    </div>
  </form>
</template>

<script>
export default {
  name: "Form",
  methods: {
    handleSubmit() {
      const name = document.getElementById("name").value.trim();
      const email = document.getElementById("email").value.trim();
      const password = document.getElementById("password").value.trim();
      const data = { name, email, password };

      console.log(data);

      axios.post("/signup", { data }).then(res => console.log(res));
    }
  }
};
</script>
前端包.json

{
  "name": "vue-ui",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@vue/cli-plugin-babel": "^4.0.0",
    "@vue/cli-plugin-eslint": "^4.0.0",
    "@vue/cli-service": "^4.0.0",
    "axios": "^0.19.0",
    "babel-eslint": "^10.0.3",
    "core-js": "^3.3.2",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "node-sass": "^4.13.0",
    "normalize.css": "^8.0.1",
    "sass-loader": "^8.0.0",
    "vue": "^2.6.10",
    "vue-template-compiler": "^2.6.10"
  },
  "devDependencies": {},
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "rules": {
      "no-console": "off",
      "no-debugger": "off"
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "proxy": "http://localhost:5000"
}
{
  "name": "testing",
  "version": "3.0.0",
  "engines": {
    "node": "10.x"
  },
  "scripts": {
    "start": "node server",
    "build": "cd vue-ui/ && npm install && npm run build",
    "dev": "npm-run-all --parallel dev-server dev-client",
    "dev-server": "nodemon server",
    "dev-client": "cd vue-ui/ && npm run serve"
  },
  "cacheDirectories": [
    "node_modules",
    "vue-ui/node_modules"
  ],
  "dependencies": {
    "bcrypt": "^3.0.5",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "express": "^4.16.4",
    "mysql": "^2.17.1",
    "uuid": "^3.3.3"
  },
  "devDependencies": {
    "nodemon": "^2.0.2",
    "npm-run-all": "^4.1.5"
  }
}

你能提供邮递员的截图吗?你在打电话吗http://localhost:5000在开发工具的网络选项卡中?看起来您正在呼叫
:8080
端口以下是邮递员的屏幕截图:。Vue开发服务器在端口8080上运行,my node.js服务器侦听5000。我在前端有一个代理,可以让它工作。虽然我现在看到我的实现可能是
{
  "name": "testing",
  "version": "3.0.0",
  "engines": {
    "node": "10.x"
  },
  "scripts": {
    "start": "node server",
    "build": "cd vue-ui/ && npm install && npm run build",
    "dev": "npm-run-all --parallel dev-server dev-client",
    "dev-server": "nodemon server",
    "dev-client": "cd vue-ui/ && npm run serve"
  },
  "cacheDirectories": [
    "node_modules",
    "vue-ui/node_modules"
  ],
  "dependencies": {
    "bcrypt": "^3.0.5",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "express": "^4.16.4",
    "mysql": "^2.17.1",
    "uuid": "^3.3.3"
  },
  "devDependencies": {
    "nodemon": "^2.0.2",
    "npm-run-all": "^4.1.5"
  }
}