Lukas
Lukas

Reputation: 245

After npm run deploy errors occured

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

Upvotes: 4

Views: 14885

Answers (4)

Mazharul Hasan
Mazharul Hasan

Reputation: 11

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

Upvotes: 1

Vivekchauhan
Vivekchauhan

Reputation: 51

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

Upvotes: 5

Abhishek Kumar
Abhishek Kumar

Reputation: 1040

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.

Upvotes: 13

Daniel Dwyer
Daniel Dwyer

Reputation: 11

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

Upvotes: 1

Related Questions