I have a react app created using create-react-app. It runs fine with no errors on my local host.
I have a repository for it on github and I am on the master branch. when I run npm run deploy the app builds with no issues but then when it comes to deployment I get the following messages:
fatal: HttpRequestException encountered.
An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Gaz\AppData\Roaming\npm-cache\_logs\2018-03-11T22_02_32_295Z-debug.log
the complete log is here below:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Gaz\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'deploy' ]
2 info using npm@5.7.1
3 info using node@v8.9.3
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle my-app@0.1.0~predeploy: my-app@0.1.0
6 verbose lifecycle my-app@0.1.0~predeploy: unsafe-perm in lifecycle true
7 verbose lifecycle my-app@0.1.0~predeploy: PATH: C:\Users\Gaz\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\my-app\node_modules\.bin;C:\Users\Gaz\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Gaz\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Users\Gaz\AppData\Local\Microsoft\WindowsApps;C:\Users\Gaz\AppData\Roaming\npm;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
8 verbose lifecycle my-app@0.1.0~predeploy: CWD: C:\my-app
9 silly lifecycle my-app@0.1.0~predeploy: Args: [ '/d /s /c', 'npm run build' ]
10 silly lifecycle my-app@0.1.0~predeploy: Returned: code: 0 signal: null
11 info lifecycle my-app@0.1.0~deploy: my-app@0.1.0
12 verbose lifecycle my-app@0.1.0~deploy: unsafe-perm in lifecycle true
13 verbose lifecycle my-app@0.1.0~deploy: PATH: C:\Users\Gaz\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\my-app\node_modules\.bin;C:\Users\Gaz\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Gaz\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Users\Gaz\AppData\Local\Microsoft\WindowsApps;C:\Users\Gaz\AppData\Roaming\npm;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
14 verbose lifecycle my-app@0.1.0~deploy: CWD: C:\my-app
15 silly lifecycle my-app@0.1.0~deploy: Args: [ '/d /s /c', 'gh-pages -d build' ]
16 silly lifecycle my-app@0.1.0~deploy: Returned: code: 1 signal: null
17 info lifecycle my-app@0.1.0~deploy: Failed to exec deploy script
18 verbose stack Error: my-app@0.1.0 deploy: `gh-pages -d build`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (C:\Users\Gaz\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
18 verbose stack at emitTwo (events.js:126:13)
18 verbose stack at EventEmitter.emit (events.js:214:7)
18 verbose stack at ChildProcess.<anonymous> (C:\Users\Gaz\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
18 verbose stack at emitTwo (events.js:126:13)
18 verbose stack at ChildProcess.emit (events.js:214:7)
18 verbose stack at maybeClose (internal/child_process.js:925:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
19 verbose pkgid my-app@0.1.0
20 verbose cwd C:\my-app
21 verbose Windows_NT 10.0.16299
22 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Gaz\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "deploy"
23 verbose node v8.9.3
24 verbose npm v5.7.1
25 error code ELIFECYCLE
26 error errno 1
27 error my-app@0.1.0 deploy: `gh-pages -d build`
27 error Exit status 1
28 error Failed at the my-app@0.1.0 deploy script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]
I have tried adding a base name to the history in my connectedRouter (using react-router-redux), still the same error.
I updated the repository address to include my username and password credentials to rule out any logging in issues.
I renamed my repository back to its original name thinking possible this was the problem.
I also renamed the build folder created to docs and tried to run github pages that way, via the master/docs option on github (since there seems to be no option to manually choose the gh-pages branch like a lot of instructions say there is). I still did not have any luck. I do think that this is the way I will have to do it though as I have just realised when i do try and host the master/docs on github pages it does in fact show my react-app title on the browser tab but it does not load anything.
my package.json file can be seen below:
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"homepage": "https://gurtaj1.github.io/Site1",
"dependencies": {
"bootstrap-less": "^3.3.8",
"classnames": "^2.2.5",
"history": "^4.7.2",
"immutability-helper": "^2.3.0",
"lodash": "^4.17.4",
"paginator": "^1.0.0",
"prop-types": "^15.6.1",
"react": "^15.6.2",
"react-dom": "^15.6.2",
"react-js-pagination": "^3.0.1",
"react-redux": "^5.0.5",
"react-router": "^4.2.0",
"react-router-dom": "^4.1.1",
"react-router-redux": "^5.0.0-alpha.9",
"redux": "^3.7.2",
"redux-devtools-extension": "^2.13.2",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"gh-pages": "^1.1.0",
"react-scripts": "1.0.6"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
The repository is currently and originally called Site1.
What's going on here?
Is it to do with my actual app or the way in which I am trying to deploy it?
So I have now managed to get my repo onto my github pages.
I did not do it with the deploy method but with the master/docs method I mentioned in my question (using the github UI to set that docs folder as the source for my github pages). see here https://blog.github.com/2016-08-17-simpler-github-pages-publishing/ .
I think the fact that I had changed the repo name to original name when trying to get the deploy method to work and perhaps still using an old build/a build where I had not included a basename in my history, is what caused this method not to work when i first had tried.
I am satisfied with using this method and I believe this to be the popper method now, rather than the deployment method I was originally trying. Although I could not find a true source for this, the github UI indicates as such since, I saw some guidelines that tell you to select the gh-pages branch of your repo as the source for github pages, but this is no longer an option, at least not on my github repo it isn't.
I hope somebody else with the same issue can get some help from this.
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.