so i was following a Youtube tutorial on how to deploy react apps to github , and i followed these steps: 1-npm install gh-pages --save-dev 2-created a repo in github 3-git remote add origin https://github.com/alisliim/Eurikso-Mobility-Academy.git 4- added "homepage" : "https://github.com/alisliim/Eurikso-Mobility-Academy" "predeploy": "npm run build" "deploy": "gh-pages -d build" in the jason file BUT when i run the npm run deploy command it doesnt work and i get this error: This is a screen shot of the error since i couldnt copy it Please any help is appriciated
2 Answers
Try setting "homepage": "http://alisliim.github.io/Eurikso-Mobility-Academy"
because "homepage" means site URL and not repository URL.
from GitHub Docs:
The source files for a project site are stored in the same repository as their project. Unless you're using a custom domain, project sites are available at
http(s)://<user>.github.io/<repository>orhttp(s)://<organization>.github.io/<repository>.
1 Comment
CoderUni
could you explain why that works? this is better off as a comment rather than an answer
TRY THE FOLLOWING STEPS
- create a new github Repository
- Inititialize git in your project folder by running command "git init"
- create a .gitignore file and add your npm modules in it
- run command
git add - run command
git commit -m "added files" - run command
git remote add origin [email protected]:username/new_repo - run command
git push - By that all your files would have been uploaded successfully on github then you can decide to host it using heroku or any other hosting platform
If you have any issues on it, please let me know
3 Comments
Ali Slim
i did not understand the 3rd step can you please repeat what do you mean and how and where should i find these npm files and where i should create this .gitignore file ? thank you
coderboy
in your project directory, run the command "touch .gitignore" with no extensions
coderboy
and then this as three different lines in it 1. .node_modules 2. node_modules/