4

After npm run deploy i have errors like above
Repo on Github

I am trying to deploy my react-app on gh-pages on Github (create-react-app)

'gh-pages' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `npm run build&&gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] deploy script 'npm run build&&gh-page
s -d build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hello-world-4 package
,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build&&gh-pages -d build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs hello-world-4
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hello-world-4
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jan\AppData\Roaming\npm-cache\_logs\2017-05-12T17_55_00_56
9Z-debug.log
2
  • What is gh-pages?: npm run build&&gh-pages -d build Commented May 12, 2017 at 18:14
  • gh-pages is a npm library which is useful for deploying codes on github. Follow this link [facebook.github.io/create-react-app/docs/… Commented Jul 26, 2019 at 10:24

4 Answers 4

13

I got the error like this

So I run this command npm install --save gh-pages

like below

Run the command like this

After that I run the command npm run deploy

My code published successfully like below.

My code published successfully

For more details just follow this link by Facebook which is given below.

(https://facebook.github.io/create-react-app/docs/deployment#github-pages-https-pagesgithubcom)

I hope your issue will be resolved. In case of error please reply.

Sign up to request clarification or add additional context in comments.

Comments

5

please install gh-pages and it ready to go

To install

npm install gh-pages

to deploy

add this to package.json

"predeploy": "npm run build",
 
"deploy": "gh-pages -d build"

and then this

npm run deploy

Comments

1

gh pages stands for GitHub Pages. It is simply a way to deploy a website via a github repo. Basically, NPM is yelling because when it attempts to run the command deploy, there is not link or reference to the line

$npm run build&&gh-pages -d build

You need make sure that gh-pages -d build is defined. A place to start would be running gh-pages --man or gh-pages --help

Comments

1

I facing the same problem I do the following command before git push not working. After

git push

I do the same command it works correctly.

npm install gh-pages

and deploy

npm run deploy

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.