在Netlify上进行React / Node部署

时间:2018-08-17 20:45:33

标签: node.js reactjs heroku mern netlify

我最近将一个应用程序部署到new_data_frame.reset_index(drop=True, inplace=True) 。但是我想知道如何将同一应用程序部署到heroku

我创建了一个在Heroku中可以正常工作的脚本:

Netlify

我添加了与"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client". 中相同的全局变量,并且我也运行了相同的脚本,但出现此错误:

Heroku

client package.json

2:34:44 PM: Error running command: Build script returned non-zero exit 
code: 127
2:34:44 PM: Failing build: Failed to build site
2:34:44 PM: failed during stage 'building site': Build script returned 
non-zero exit code: 127
2:34:44 PM: Finished processing build request in 25.404662076s

server package.json

    {
   "name": "client",
   "version": "0.1.0",
   "private": true,
   "dependencies": {
   "axios": "^0.18.0",
   "classnames": "^2.2.5",
   "jwt-decode": "^2.2.0",
   "moment": "^2.22.0",
   "react": "^16.3.1",
   "react-dom": "^16.3.1",
   "react-moment": "^0.7.0",
   "react-redux": "^5.0.7",
   "react-router-dom": "^4.2.2",
   "react-scripts": "1.1.4",
   "redux": "^3.7.2",
   "redux-thunk": "^2.2.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
      "proxy": "http://localhost:5000"
}

1 个答案:

答案 0 :(得分:0)

在尝试部署后端时,Netlify不如Heroku那样直接。基本答案,不能。

https://www.netlify.com/docs/functions/ 有一种使它起作用的方法,请参见上面的链接,但我不知道该怎么做。