Skip to content
This repository has been archived by the owner on Oct 24, 2019. It is now read-only.

Deployment to server #4

Closed
Prashant-Mutnale opened this issue Mar 25, 2019 · 13 comments
Closed

Deployment to server #4

Prashant-Mutnale opened this issue Mar 25, 2019 · 13 comments

Comments

@Prashant-Mutnale
Copy link

How could i deploy it to surge or node server?Trying to deploy it in firebase but it didn't work out

@maxparelius
Copy link
Contributor

@Prashant-Mutnale since this is a server-side rendered app you can host on any platform that supports node. I believe firebase and surge support static websites only so those tools will not work. If you are looking for a simple solution I recommend Heroku. I can add some documentation on deploying to Heroku. I will let you know when that is done.

@Prashant-Mutnale
Copy link
Author

Thanks @maxparelius for the response, sure i will try to deploy it in Heroku.
It would be great if you could provide us with the documentation, i will wait for it

@maxparelius
Copy link
Contributor

@Prashant-Mutnale I have a deployment documentation section here and has information about deploying to heroku: https://trustworktech.github.io/create-react-ssr-app/docs/deployment

@Prashant-Mutnale
Copy link
Author

Prashant-Mutnale commented Mar 25, 2019

Thanks @maxparelius for the documentation I did deploy it to heroku but i'm facing some issue with the http i guess i have attached the image below

Screenshot 2019-03-26 at 12 05 42 AM

@maxparelius
Copy link
Contributor

@Prashant-Mutnale unable to see the screen shot

@maxparelius
Copy link
Contributor

@Prashant-Mutnale can I see what your Procfile looks like?

@Prashant-Mutnale
Copy link
Author

Prashant-Mutnale commented Mar 25, 2019

@maxparelius i don't have any Procfile in my root directory.
Do i need to create it ?

i even tried to deploy the create-react-ssr-app without anychanges but still its showing the same error for it
I have attached the image

Screenshot 2019-03-26 at 12 57 24 AM

@maxparelius
Copy link
Contributor

@Prashant-Mutnale I would create a file called Procfile in your root dir and add the following:

web: node build

You will also need to build the app during heroku deployments so would add an npm script like so to build the app: "heroku-postbuild": "yarn build"

@Prashant-Mutnale
Copy link
Author

Prashant-Mutnale commented Mar 26, 2019

Thanks @maxparelius I followed the steps by adding Procfile and adding script to the package.json
The build successfully gets deployed but when i open the link in the browser i'm getting this page

Screenshot 2019-03-26 at 10 00 41 PM

So when i check it by running the heroku logs --tail it shows the error as Error: Cannot find module '/app/build'

Screenshot 2019-03-26 at 9 58 54 PM

my Procfile consists as
web: node build

and package.json as

{
"name": "tagmetoo",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^4.3.1",
"express": "^4.16.4",
"firebase": "^5.9.1",
"react": "^16.8.5",
"react-bootstrap": "^1.0.0-beta.6",
"react-dom": "^16.8.5",
"react-redux": "^6.0.1",
"react-router-dom": "^5.0.0",
"react-ssr-scripts": "1.0.4",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-promise": "^0.6.0",
"redux-thunk": "^2.3.0",
"serialize-javascript": "^1.6.1"
},
"scripts": {
"start": "react-ssr-scripts start",
"build": "react-ssr-scripts build",
"test": "react-ssr-scripts test",
"eject": "react-ssr-scripts eject",
"heroku-postbuild": "npm build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}

@maxparelius
Copy link
Contributor

@Prashant-Mutnale Sorry for the delay. I investigated and saw I had a bug in the package. Thanks for patience. Go ahead and update react-ssr-scripts with yarn add react-ssr-scripts to get the fix. You can remove the heroku-postbuild script which is not needed. Keep the Procfile how you have it and then try and deploy again.

@maxparelius
Copy link
Contributor

I verified its working on my end.

@maxparelius
Copy link
Contributor

@Prashant-Mutnale were you able to get it working? Can I close?

@Prashant-Mutnale
Copy link
Author

Yes @maxparelius we can close it now its working fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants