简体   繁体   中英

Issues deploying a MERN application to Vercel or heroku?

I'm presenting problems while trying to deploy my app, I manage to deploy my github repository into vercel and heroku but when I open de live app it just shows a white screen.

I think it's related to my package.json or something similar.

Here is my package.json:

{
  "name": "marvel-searcher",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "client": "npm start --prefix react-client",
    "dev": "concurrently \"npm run server\" \"npm run client\"",
    "build": "run dev",
    "server": "node server"
  },
  "author": "David Liendo",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.20.0",
    "body-parser": "^1.19.0",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "md5": "^2.3.0",
    "concurrently": "^5.3.0",
    "dotenv": "^8.2.0"
  },
  "devDependencies": {
    "concurrently": "^5.3.0",
    "dotenv": "^8.2.0",
    "nodemon": "^2.0.4"
  }
}

My github repository: https://github.com/DavLiendoProgramming/marvelHeroes My vercel link: https://marvel-heroes-black.vercel.app/

Please help :(

Change "server": "node server" to "start": "node server" , and create a Procfile in the root of your project for Heroku.

Inside your Procfile on the first line, put web: npm start

  1. You can change server":"node server to start: node server on your package.json

  2. create Procfile and paste web: node server.js on the file Heroku will automatically run your server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM