npm ERR!缺少脚本:构建heroku部署node + react

时间:2020-04-27 12:06:31

标签: node.js reactjs heroku npm

我正在尝试部署节点并响应应用程序。 docappointment是根文件夹。 Client / docappointment-ui是react项目。

我的客户build中有package.json。但是我仍然得到npm ERR! missing script: build。我在根docappointment文件夹中运行推送。

这是我的根package.json

    {
  "name": "docappointment",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "install": "cd client/docappointment-ui && npm run build", //changing directory to client/docappointment-ui
    "heroku-prebuild": "npm install",
    "heroku-postbuild": "cd client/docappointment-ui && npm install && npm run build",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "engines": {
    "node": "^10.3.0", 
    "npm": "^6.8.0" 
},
  "dependencies": {

    "socket.io": "^2.3.0",
    "validator": "^13.0.0"
  }
}

这是package.json个反应。

    {
  "name": "docappointment-ui",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "antd": "^4.1.2",
    "axios": "^0.19.2",
    "moment": "^2.24.0",
    "react": "^16.13.1",
    "react-chat-widget": "^3.0.0",
    "react-dom": "^16.13.1",

    "react-router-dom": "^5.1.2",
    "react-scripts": "3.4.1",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0",
    "socket.io-client": "^2.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

文件夹结构image

0 个答案:

没有答案