Deploy React JS SPA in Openshift - reactjs

I have build a React JS app and triggered yarn build command. Its builded successfully and if I run yarn global add serve, its working perfectly on http://localhost:5000. After that I tried below link to deploy this code to OpenShift.
OpenShift Deployment
According to the document, I tried to run npx nodeshift --strictSSL=false --dockerImage=bucharestgold/centos7-s2i-web-app --imageTag=10.13.0 --build.env YARN_ENABLED=true --expose
Then I got this log -
npx: installed 216 in 37.284s
kubernetes-client deprecated require('kubernetes-client').config, use require('kubernetes-client/backends/request').config. ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\lib\openshift-rest-client.js:25:35
kubernetes-client deprecated require('kubernetes-client').config, use require('kubernetes-client/backends/request').config. ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\index.js:23:39
2019-12-21T11:58:07.841Z INFO loading configuration
kubernetes-client deprecated fromKubeconfig see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md#request-kubeconfig- ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\lib\nodeshift-config.js:35:32
2019-12-21T11:58:07.882Z INFO using namespace smart-learner at https://c101-e.jp-tok.containers.cloud.ibm.com:30512
kubernetes-client deprecated Client({ config }), see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\lib\openshift-rest-client.js:95:18
kubernetes-client deprecated Request() without a .kubeconfig option, see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\kubernetes-client\lib\swagger-client.js:200:19
2019-12-21T11:58:07.928Z WARNING a file property was not found in your package.json, archiving the current directory.
2019-12-21T11:58:07.929Z INFO creating archive of .gitignore, build, Dockerfile, package-lock.json, package.json, public, README.md, src, yarn.lock
2019-12-21T11:58:09.001Z INFO using existing build configuration smartlearner-s2i
2019-12-21T11:58:09.377Z INFO using existing image stream smartlearner
2019-12-21T11:58:09.378Z INFO uploading binary archive C:\ReactAPP\smartlearner/tmp/nodeshift/build/archive.tar
2019-12-21T11:58:15.825Z INFO binary upload complete
2019-12-21T11:58:15.828Z INFO waiting for build to finish
kubernetes-client deprecated .getStream use .getByteStream, see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\lib\build-watcher.js:56:107
2019-12-21T11:58:19.798Z TRACE Using bucharestgold/centos7-s2i-web-app:10.x as the s2i builder image
2019-12-21T11:58:20.550Z TRACE ls: cannot access /tmp/src/node_modules: No such file or directory
2019-12-21T11:58:20.564Z TRACE ---> Installing application source
2019-12-21T11:58:20.585Z TRACE ---> Building your Web Application from source
2019-12-21T11:58:20.592Z TRACE Current git config
2019-12-21T11:58:20.620Z TRACE url.https://github.com.insteadof=git#github.com:
2019-12-21T11:58:20.629Z TRACE url.https://.insteadof=ssh://
2019-12-21T11:58:20.629Z TRACE url.https://github.com.insteadof=ssh://git#github.com
2019-12-21T11:58:20.630Z TRACE ---> Using 'yarn install' with YARN_ARGS
2019-12-21T11:58:21.356Z TRACE yarn install v1.10.1
2019-12-21T11:58:21.594Z TRACE warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
2019-12-21T11:58:21.657Z TRACE [1/4] Resolving packages...
2019-12-21T11:58:23.111Z TRACE [2/4] Fetching packages...
2019-12-21T11:58:53.081Z TRACE error #typescript-eslint/eslint-plugin#2.10.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "10.12.0"
2019-12-21T11:58:53.083Z TRACE error Found incompatible module
2019-12-21T11:58:53.086Z TRACE info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2019-12-21T11:58:58.441Z TRACE error: build error: non-zero (13) exit code from bucharestgold/centos7-s2i-web-app:10.x
2019-12-21T11:59:00.497Z ERROR build failed with message: Assemble script failed.
2019-12-21T11:59:00.503Z ERROR Assemble script failed.
i am not able to understand what I am missing here. I found that bucharestgold/centos7-s2i-web-app has been depreicated and tried with npx nodeshift --strictSSL=false --dockerImage=nodeshift/ubi8-s2i-web-app --build.env YARN_ENABLED=true --deploy.env NPM_RUN="npx yarn start" --deploy.port=3000 --expose. This is also throwing same error message.

You can use the new web-app flag feature and let nodeshift set the appropriate docker image.
Try running this command instead npx nodeshift --web-app --build.env YARN_ENABLED=true --deploy.env NPM_RUN="npx yarn start" --deploy.port=3000

Related

Github deploying issues

When I try to use npm run deploy on github, it throws me the following errors:
fatal: bad object refs/remotes/origin/main
error: github.com:Aris-Empanta/Accountant_landing_page.git did not send all necessary objects
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: bad ref for .git/logs/refs/remotes/origin/main
fatal: bad object refs/remotes/origin/main
fatal: failed to run repack
error: task 'gc' failed
Any suggestions?
Though VS code command line, everytime I change my project I push the changes you know, git add, git commit, git push origin. After that when I confirm the merging from github, I write npm run deploy to deploy the changed project to gh-pages. It was working, but suddenly stopped.

Next JS : Error: EPERM: operation not permitted, open

I am trying to build the next Js app production files to deploy it on cPanel, when I execute
npm run dev the app is working just fine but as I start to build a production file with the help of this video(https://youtu.be/1ykSXau838c) and executes npm run build it gives me an error in the terminal as given below:
PS C:\Users\hp\Desktop\reactJs-project\NextJs\test-app> npm run build
> test-app#0.1.0 build
> next build
info - Checking validity of types
info - Creating an optimized production build .node:events:368
throw er; // Unhandled 'error' event
^
Error: EPERM: operation not permitted, open 'C:\Users\hp\Desktop\reactJs-project\NextJs\test-app\.next\trace'
Emitted 'error' event on WriteStream instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: 'C:\\Users\\hp\\Desktop\\reactJs-project\\NextJs\\test-app\\.next\\trace'
}
so I just want to know is there any way to solve this problem?
Posting comment from Koronag as an answer (as it helped me with this error and seems the most likely cause)...
This error is commonly seen when running a build while the dev server is already running. (E.g. in my case, I had a local build running via npm run dev and was trying to commit/push code, which invoked a Git Hook that also runs npm run dev.)
For me, it works fine this answer drives me to the resolver.
I run 2 scripts in terminals:
once for development
another for the build process.
So after killing the development script it looks perfectly fine!
From next-sitemap repo README.md
"Having next-sitemap command & next-sitemap.js file may result in file opening instead of building sitemaps in windows machines.
As a solution to this, it is now possible to use a custom config file instead of next-sitemap.js. Just pass --config .js to build command."
Next-Sitemap README.md - Building Sitemaps
The above worked for me

Azure DevOps ionic Error building android

While running Azure DevOps tasks for cordova to build android getting following error, but the same code build fine in local machine!
[ERROR] An error occurred while running subprocess cordova.
cordova platform add android#8.0.0 --verbose exited with exit code 1.
Even including --verbose doesnt give any more insights into whats went wrong! Any clues on resolving this?
Log :
2020-06-10T12:07:08.9595670Z Updating icons at platforms/android/app/src/main/res
2020-06-10T12:07:08.9595970Z Updating splash screens at platforms/android/app/src/main/res
2020-06-10T12:07:08.9596290Z This app does not have additional resource files defined
2020-06-10T12:07:08.9596560Z Prepared android project successfully
2020-06-10T12:07:08.9597390Z Executing script found in plugin cordova-plugin-add-swift-support for hook "after_prepare": plugins/cordova-plugin-add-swift-support/add-swift-support.js
2020-06-10T12:07:08.9597890Z Resolving module name for glob => glob
2020-06-10T12:07:08.9598130Z Saving android#8.0.0 into platforms.json
2020-06-10T12:07:08.9598640Z --save flag or autosave detected
2020-06-10T12:07:08.9598910Z Saving android#~8.0.0 into config.xml file ...
2020-06-10T12:07:08.9599200Z adding android to cordova.platforms array in package.json
2020-06-10T12:07:08.9599480Z No scripts found for hook "after_platform_add".
2020-06-10T12:07:08.9599780Z [ERROR] An error occurred while running subprocess cordova.
2020-06-10T12:07:08.9600000Z
2020-06-10T12:07:08.9600570Z cordova platform add android#8.0.0 --verbose exited with exit code 1.
2020-06-10T12:07:08.9600850Z
2020-06-10T12:07:08.9601610Z Re-running this command with the --verbose flag may provide more information.
2020-06-10T12:07:08.9602390Z 2020-06-10T12:07:08.134Z ionic:utils-process onBeforeExit handler: 'process.exit' received
2020-06-10T12:07:08.9603200Z 2020-06-10T12:07:08.134Z ionic:utils-process onBeforeExit handler: running 1 functions
2020-06-10T12:07:08.9603970Z 2020-06-10T12:07:08.162Z ionic:utils-process processExit: exiting (exit code: 1)
2020-06-10T12:07:08.9604510Z [0m]

Why are the steps I took to fix 'builds' in Netlify/Hugo not working?

Netlify/Hugo is not updating the changes I have pushed to Github. This is a weird issue since I have, as far as I am concerned, not done anything different from what I have been doing before this problem occurred.
I have followed the instructions of this book and the one offered by of Netlify but none worked.
I have also contacted Netlify but could not completely understand what I am supposed to do after they answered me. See below.
When I take a look at your builds, I see hugo errors. I suspect you'd get them locally too in case you use hugo 0.53 locally? When you clone a FRESH COPY of your directory (rather than one you've made local changes in), and try to run hugo 0.53/extended, do builds work better? If so then your next debugging steps will be here: https://github.com/netlify/build-image#running-locally to run our build container yourself to try to debug.
What I did based on this response was the following:
i) I went to RStudio and opened 'shell' in 'Git'. There I wrote 'git clone https://github.com/website_address.git'.
ii) As a result of this command in Git, a new folder opened in the repository.
iii) Then I started 'command prompt' in my laptop to run hugo '0.53/extended'. 'C:\Users\NewUser>docker pull netlify/build:v0.53/extended'. This resulted in the following error message: 'docker' is not recognized as a internal or external command, operable program or batch file.
I have made slight modifications to 'v.0.53/extended' but the error persists. I have also tried this line of code in Git but to no avail.
iv) I have also created a README folder in my Github repository and copied this snippet provided by Netlify:
[![Netlify Status](https://api.netlify.com/api/v1/badges/b3749a18-96fa-4abc-bfc7-1d4a331ae78e/deploy-status)](https://app.netlify.com/sites/website_address/deploys)
but the problem persists.
This is one of the error messages that Netlify shows:
2:31:20 PM: Build ready to start
2:31:21 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
2:31:21 PM: build-image tag: v3.3.2
2:31:21 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
2:31:22 PM: Fetching cached dependencies
2:31:22 PM: Starting to download cache of 104.5MB
2:31:22 PM: Finished downloading cache in 626.785348ms
2:31:22 PM: Starting to extract cache
2:31:25 PM: Finished extracting cache in 3.003714699s
2:31:25 PM: Finished fetching cache in 3.716551911s
2:31:25 PM: Starting to prepare the repo for build
2:31:26 PM: Preparing Git Reference refs/heads/master
2:31:28 PM: Error checking out submodules: fatal: No url found for submodule path 'Blogdown' in .gitmodules
2:31:28 PM: Failing build: Failed to prepare repo
2:31:28 PM: failed during stage 'preparing repo': Error checking out submodules: fatal: No url found for submodule path 'Blogdown' in .gitmodules
: exit status 128
2:31:28 PM: Finished processing build request in 6.17222572s
2:31:28 PM: Shutting down logging, 0 messages pending
I suspect that the answer for solving my problem is hinted here:
Error checking out submodules: fatal: No url found for submodule path 'Blogdown' in .gitmodules.
So I checked this answer but I am still in the dark about what I am supposed to do.
I am obviously doing some(probably many)things wrong here. But I have no idea where and what these mistakes are.
It would be great if someone could guide a newbie like me out of this hole.
Much appreciated.
ps. Github and RStudio are communicating well.
Previously, I've had similar issues in different projects. After trying a bit around I found a solution. My solution is to decouple the submodule and move the code into my codebase (or using a managed package for this).
To decouple the module go into your submodule folder, delete the .git folder and add the files to your git repository. On the command line I would do it like this:
// going into the submodule - might need to tweaked, depending on the exact path
cd Blogdown
// delete the git submodule
rm -rf .git
// going out of the directory
cd ..
// adding everything to git
git add .
With these steps (and potentially minor tweaks to the paths) I've been able to resolve this issue for me.

React Native Installation

I'm trying to install React Native by following instructions on this page : https://facebook.github.io/react-native/docs/getting-started.html
but when I want to run my new project I obtain several errors and a log file is created with all what happened during the procedure.
The link to see the log : https://drive.google.com/open?id=0B8Sis1RFrKgiZTFTRWFLUmZpZlk
Thank you !
You need to install git, as you log says.
2223 error not found: git
2224 error Failed using git.
2224 error This is most likely not a problem with npm itself.
2224 error Please check if you have git installed and in your PATH.
2225 verbose exit [ 1, true ]
Here you can find how to do it:
Installing Git

Resources