Could not read from a remote repository when publishing my site - reactjs

I am using docusaurus to write a documentation website for a product. I made some customizations to the site and try to publish it on GitHub.
Following the tutorial, I config the website/siteConfig.js, ran npm run build and used :
$ GIT_USER=<GIT_USER> CURRENT_BRANCH=master USE_SSH=true npm run publish-gh-pages
to push it to Github. Cloning to gh-pages fails and shows "fatal: Could not read from remote repository." error.
The following git commands were what I used.
LM-SHC-16507799:website benshi$ ls
README.md core node_modules sidebars.json yarn.lock
blog git package.json siteConfig.js
build i18n pages static
LM-SHC-16507799:website benshi$ pwd
/Users/user_name/Desktop/calender/week_3/docusaurus-exp/website
LM-SHC-16507799:website user_name$ GIT_USER=my_github_user_name CURRENT_BRANCH=master USE_SSH=true npm run publish-gh-pages
It failed. The following error messages were shown.
> # publish-gh-pages /Users/user_name/Desktop/calender/week_3/docusaurus-exp/website
> docusaurus-publish
master
https://github.com/my_github_user_name/docusaurus-exp.git
generate.js triggered...
feed.js triggered...
feed.js triggered...
sitemap.js triggered...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
Site built successfully. Generated files in 'build' folder.
89b1f1bd2f7e2403a08a194a89379916edcbb540
Cloning into 'docusaurus-exp-gh-pages'...
ssh_exchange_identification: read: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: git clone failed
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # publish-gh-pages: `docusaurus-publish`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # publish-gh-pages 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! /Users/user_name/.npm/_logs/2019-07-18T07_15_37_998Z-debug.log

The issue is not related with Docusaurus indeed.
The error was cause when I tried to publish the site tp gh-pages branch with USE_SSH=true. In fact I don't have SSH stored on this machine. The issue was resolved by romoving this parameter (or set USE_SSH=false).

Related

Error 404 on React site after a failed build. File cannot be found

I have a react app which build and deploys fine on my development environment. Now I did some refactoring which was limited to moving a few files, commiting, testing and redeploying. After the latest change I deployed to productiong and found that on production I got a 404 when accessing the site. 404 not found. I'm completely stumped as to what may be the problem.
Reviewing the bitbucket pipeline I get the following output:
./src/pages/Home.jsx
Cannot find file '../components/narrative/Narrative' in './src/pages'.
Now if I have a look at './src/pages/Home.jsx' I can see I'm importing the below
import Narrative from "../components/narrative/Narrative"
And that file does indeed exist:
The full output of the pipeline is here:
root#ubuntu-web:~/eg-web# npm run build
> refgator-web#0.1.0 build /root/eg-web
> react-scripts build
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist#latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Failed to compile.
./src/pages/Home.jsx
Cannot find file '../components/narrative/Narrative' in './src/pages'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! refgator-web#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the refgator-web#0.1.0 build 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! /root/.npm/_logs/2022-02-16T10_23_04_697Z-debug.log
And if I go to the production server this is the latest error log:
This was actually caused by the folder name as it is locally called narrative. On the repo it's Narrative
I changed this with help from this answer In a Git repository, how to properly rename a directory?

Failed to get remote.origin.url task must either be run in a git repository with a configured origin remote or must be configuredwith the 'repo option

In my weather-app I am using npm run deploy command in terminal
But it gives this error:
Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the "repo" option).
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! weather_app#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the weather_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! /home/pankaj/.npm/_logs/2021-11-22T19_38_21_874Z-debug.log
Also I don't know which command should i write to get access to my git repository which is already pushed on my github account...
I had the same issue. I solved it by putting the following commands in the terminal: git init, get remote add origin (copy and paste the url from your github repository here, the parentheses are not needed), and then npm run deploy
I cloned the repo again, did npm run deploy and it worked for me!
I had the same issue. I believe it was because I forgot to run "git init" at the start of development. I just cloned my repository and it sorted itself out.
I had this issue too...:
Initially I had my project on external hard disk so I made a local copy of my project and tried the "npm run deploy" command again and it worked for me. (Just make sure your remote origin is correct).
I hope this helps.

how to publish a react js website on gitlab

i created a static react js project and i pushed it to git-lab excluding node modules. But now i am not able to publish my website it is showing deploy failed. but the build was successful. i know that i should make some changes to packagejson file but i dont know what all changes to be done. kindly please guide me in this issue
npm ERR! npm bugs my-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /builds/Adithyets/react-website/npm-debug.log
Cleaning up file based variables
ERROR: Job failed: exit code 1

Receive error when deploy to GitHub pages

I'm deploy react app to git hub pages and receive error. File sizes after gzip:
68.67 KB build\static\js\2.c2c334ae.chunk.js
2.98 KB build\static\js\main.8a72b1a2.chunk.js
774 B build\static\js\runtime~main.8f8a00a4.js
The project was built assuming it is hosted at /sort-customers-list/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
To publish it at https://sejob.github.io/sort-customers-list,
run: npm run deploy
Find out more about deployment here:
sort-customers-list#0.1.0 deploy
C:\Users\SeJo\Documents\Code\DEV_HW\sort-customers-list
gh-pages -d build
The "file" argument must be of type string. Received type undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sort-customers-list#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sort-customers-list#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\SeJo\AppData\Roaming\npm-cache\_logs\2019-08-01T12_09_52_445Z-debug.log
The problem occurs in the new version of GitHub pages. Just use this command to install the previous version of GitHub pages:
npm install gh-pages#2.0.1
Hope it will help!
I also had this same problem on a fresh install of create-react-app. I have no idea what the problem was, but I did the following:
Downgrade gh-pages from 2.1.0 to 2.0.1
Instead of running npm run deploy, manually run npm run build then gh-pages -d build from the commandline.
At first, I'd get the same error in the commandline, even after checking that the version was downgraded to 2.0.1, but for some reason it worked after manually creating the gh-pages branch and pushing some files into it. As of now, npm run deploy throws the error but at least gh-pages -d build from the console works.
INSTALL/REINSTALL GIT
Update NPM
Reopen EDITOR
this solved my problem
use version 2.0.1
npm i gh-pages#2.0.1

Cannot deploy with npm run Deploy in React on github pages

unfortunately I cannot deploy on GitHub my Color-recognition App in React JS on GitHub pages. I am using Webpack as bundler.
My system configuration is:
Webpack
Environment:
OS: Windows 10
Node: 8.12.0
Yarn: Not Found
npm: 6.4.1
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.5.2 => 16.5.2
react-dom: ^16.5.2 => 16.5.2
react-scripts: 1.1.5 => 1.1.5
I use extra added dependencies of Clarifai and Gsap and used the following steps:
I created on my Github account the repository Color-recognition without md file, and within added gh-pages branch, and in setting of repository under Source added gh-pages branch.
git add .
git commit -m "Uploading files"
git push -f origin master:gh-pages
git remote add origin
https://github.com/Geeeva/Color-recognition.git npm run deploy
The page should be deployed but it couldn't, with the error below. I wanted to put the project demo that is visible.
Tried the same procedure with the master branch of the Color-recognition, and I got the same error.
The error is following:
Cannot read property 'email' of null
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! color-recognition-depl#0.1.0 deploy: gh-pages -d build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the color-recognition-depl#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ivana\AppData\Roaming\npm-cache_logs\2018-09-19T19_58_34_ 829Z-debug.log
Link to my Github repo is: https://github.com/Geeeva/Color-recognition
I managed to fix it by setting my git config user name and email. (As
the link provided above specifies the need of both).
So just write in the terminal:
git config --global user.name your name
git config --global user.email #youremail
source: https://www.reddit.com/r/reactjs/comments/9hlin1/unable_to_deploy_react_app_to_github_pages/

Resources