Deploy React app with gh-pages after moving local folder - reactjs

I'm having trouble deploying my React app with gh-pages since I moved my local directory from the main disk to a secondary disk on my laptop (I was running out of space).
Directory: https://github.com/jorislimonier/jorislimonier.github.io/
Here is the output of npm run deploy:
joris#joris-N751JK:/media/joris/projects/personal-website$ npm run deploy
> joris.limonier.github.io#0.1.0 predeploy
> npm run build
> joris.limonier.github.io#0.1.0 build
> react-scripts build
Creating an optimized production build...
warn - The `content` option in your Tailwind CSS configuration is missing or empty.
warn - Configure your content sources or your generated CSS will be missing styles.
warn - https://tailwindcss.com/docs/content-configuration
Compiled successfully.
File sizes after gzip:
75.73 kB build/static/js/main.27c91ea0.js
12.63 kB build/static/css/main.5cfc2ee1.css
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
npm install -g serve
serve -s build
Find out more about deployment here:
https://cra.link/deployment
> joris.limonier.github.io#0.1.0 deploy
> gh-pages -d build
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).
I tried:
git remote remove origin
git remote add origin https://github.com/jorislimonier/jorislimonier.github.io.git
Any idea?

Related

Recieved this picture after deploying firebase

i cannot fix this issue...
Terminal:
PS C:\Users\lenovo\Documents\reactProjects\linkedin-clone> npm run build
linkedin-clone#0.1.0 build
react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
226 kB build\static\js\main.0f7d0368.js
1.69 kB build\static\css\main.e40a2faa.css
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
serve -s build
Find out more about deployment here:
https://cra.link/deployment

Running react-snap on AWS codebuild

I have a react website that I host on AWS. I have created code pipeline in AWS that connects to my github, which automatically builds the projects using codeBuild and deploys it to S3.
I'm trying to add react-snap to the project. It works well locally but when I try to build it in codebuild I get this error
Error: Failed to launch chrome!
/codebuild/output/src159566889/src/node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/chrome: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/codebuild/output/src159566889/src/node_modules/puppeteer/lib/Launcher.js:348:14)
at Interface.<anonymous> (/codebuild/output/src159566889/src/node_modules/puppeteer/lib/Launcher.js:337:50)
at Interface.emit (events.js:326:22)
at Interface.close (readline.js:416:8)
at Socket.onend (readline.js:194:10)
at Socket.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
error Command failed with exit code 1.
I have tried to google it but I didn't find anything specific to codebuild and react-snap. I have found similar questions in regards to running chrome on codebuild but they related to different environments like angular and so I wasn't able to copy their solutions.
This is what my current buildspec.yaml file looks like
version: 0.2
env:
variables:
S3_BUCKET: "xyz"
STAGE: "beta"
phases:
install:
commands:
- yarn install
build:
commands:
- echo "Building for $STAGE"
- yarn build
- sam package --template-file cloudformation/Root.json --s3-bucket ${S3_BUCKET} --s3-prefix WebsiteCF/${CODEBUILD_RESOLVED_SOURCE_VERSION} --output-template-file build/packaged-template.yaml
artifacts:
files:
- '**/*'
base-directory: 'build'
Based on the instruction on the link provided by the error, I tried adding this but it didn't work
install:
commands:
- PYTHON=python2 amazon-linux-extras install epel -y
- yum install -y chromium
- yarn install
I managed to get it working using these steps:
Make sure your AWS code builder is using aws/codebuild/standard:5.0
Go t AWS code builder -> Edit -> Environment -> Override image
Create a addArgs.sh file to your project with this content
# modifies react-snap defaultOptions to add the --no-sandbox and --disable-setuid-sandbox flags so that puppeteer/chromium can run in the codebuild standard image
sed -i "s/puppeteerArgs: \[\],/puppeteerArgs: \[\"--no-sandbox\", \"--disable-setuid-sandbox\"\],/" ./node_modules/react-snap/index.js
echo changed arguments in react-snap
To your buildspec.yml file, add these lines to the install stage
# Install chrome headless
- apt-get -y update
- apt-get --assume-yes install chromium-browser
- sh ./addArgs.sh # run custom script to change options on react-snap to make it work
I found the answer from here - https://github.com/stereobooster/react-snap/issues/122

How to run Express-React project

I`m trying to understand how to run this project, published on GitHub here
No idea how. I ran npm i, and then npm start, but I got these messages:
npm start
> fed-entry-level-exam-root#1.0.0 start C:\entry-level-exam_19\entry-level-exam
> lerna run start --parallel
lerna notice cli v3.22.1
lerna info Executing command in 2 packages: "npm run start"
#fed-exam/client: > #fed-exam/client#1.0.0 start C:\entry-level-exam_19\entry-level-exam\client
#fed-exam/client: > set CI=true && react-scripts start
#fed-exam/server: > #fed-exam/server#1.0.0 start C:\entry-level-exam_19\entry-level-exam\server
#fed-exam/server: > ts-node-dev index.ts
#fed-exam/server: [INFO] 21:51:34 ts-node-dev ver. 1.1.0 (using ts-node ver. 9.1.1, typescript ver. 3.9.9)
#fed-exam/server: starting server { serverAPIPort: 3232, APIPath: '/api/tickets' }
#fed-exam/server: server running 3232
#fed-exam/client: i 「wds」: Project is running at http://192.168.0.108/
#fed-exam/client: i 「wds」: webpack output is served from
#fed-exam/client: i 「wds」: Content not from webpack is served from C:\entry-level-exam_19\entry-level-exam\client\public
#fed-exam/client: i 「wds」: 404s will fallback to /
#fed-exam/client: Starting the development server...
I tried to open http://localhost:3232/ but I getting this error:
Cannot GET /
Also tried :
http://localhost:3000
Which is known for React localhost.
So far I don't know how to make it work.
Any help will be appreciated.
run the client and server separately,
after running npm install and npm start
open a new terminal and run npm start inside client/ directory
If you carefully read messages on the console you will notice where the api is running.
The lines
#fed-exam/server: starting server { serverAPIPort: 3232, APIPath: '/api/tickets' }
#fed-exam/server: server running 3232
Shows that server project is running at port 3232, but that api path starts at /api/tickets. So, for access the root of the api, access http://localhost:3232/api/tickets.
You could check how this works by checking the express app code on server folder.
And there is a problem with the client code that is related with react-scripts when trying to run projects using lerna package. The line
Content not from webpack is served from C:\entry-level-exam_19\entry-level-exam\client\public
Was previously reported as error here: Content not from webpack is served from /foo
Try to solve the issue using our colleagues suggestions.

Deploy React JS SPA in Openshift

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

Generating a new ServiceStack React Project is missing SharpPagesFeature

I updated to the latest #servicestack/cli
npm install -g #servicestack/cli
+ #servicestack/cli#1.0.8
updated 5 packages in 5.862s
Ran the dotnet-new command:
C:\Projects\Personal> dotnet-new react-spa POETS
> uglifyjs-webpack-plugin#0.4.6 postinstall C:\Projects\Personal\POETS\POETS\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
> poets#0.1.0 postinstall C:\Projects\Personal\POETS\POETS
> npm run build
> poets#0.1.0 build C:\Projects\Personal\POETS\POETS
> rimraf wwwroot/ && react-scripts-ts build && (move build wwwroot || mv build wwwroot)
Creating an optimized production build...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
ts-loader: Using typescript#3.2.4 and C:\Projects\Personal\POETS\POETS\tsconfig.prod.json
Compiled successfully.
File sizes after gzip:
80.72 KB build\static\js\main.5832e8d6.js
29.7 KB build\static\css\main.4df18a76.css
The project was built assuming it is hosted at the server root.
You can control this with the homepage field in your package.json.
For example, add this to build it for GitHub Pages:
"homepage" : "http://myname.github.io/myapp",
The build folder is ready to be deployed.
You may serve it with a static server:
npm install -g serve
serve -s build
1 dir(s) moved.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 1564 packages in 27.283s
MSBuild auto-detection: using msbuild version '16.0.360.33175' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\bin'.
Restoring packages for C:\Projects\Personal\POETS\POETS.ServiceInterface\POETS.ServiceInterface.csproj...
Restoring packages for C:\Projects\Personal\POETS\POETS.Tests\POETS.Tests.csproj...
Restoring packages for C:\Projects\Personal\POETS\POETS\POETS.csproj...
Restoring packages for C:\Projects\Personal\POETS\POETS.ServiceModel\POETS.ServiceModel.csproj...
GET https://api.nuget.org/v3-flatcontainer/servicestack.kestrel/index.json
GET https://api.nuget.org/v3-flatcontainer/servicestack/index.json
GET https://api.nuget.org/v3-flatcontainer/nunit/index.json
GET https://api.nuget.org/v3-flatcontainer/microsoft.net.test.sdk/index.json
GET https://api.nuget.org/v3-flatcontainer/nunit3testadapter/index.json
GET https://api.nuget.org/v3-flatcontainer/servicestack.interfaces/index.json
OK https://api.nuget.org/v3-flatcontainer/servicestack.kestrel/index.json 194ms
GET https://api.nuget.org/v3-flatcontainer/servicestack.kestrel/5.4.0/servicestack.kestrel.5.4.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/nunit/index.json 237ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.net.test.sdk/index.json 246ms
OK https://api.nuget.org/v3-flatcontainer/nunit3testadapter/index.json 248ms
OK https://api.nuget.org/v3-flatcontainer/servicestack.interfaces/index.json 263ms
GET https://api.nuget.org/v3-flatcontainer/servicestack.interfaces/5.4.0/servicestack.interfaces.5.4.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/servicestack/index.json 318ms
GET https://api.nuget.org/v3-flatcontainer/servicestack/5.4.0/servicestack.5.4.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/servicestack.kestrel/5.4.0/servicestack.kestrel.5.4.0.nupkg 162ms
OK https://api.nuget.org/v3-flatcontainer/servicestack.interfaces/5.4.0/servicestack.interfaces.5.4.0.nupkg 149ms
OK https://api.nuget.org/v3-flatcontainer/servicestack/5.4.0/servicestack.5.4.0.nupkg 151ms
Installing ServiceStack.Interfaces 5.4.0.
GET https://api.nuget.org/v3-flatcontainer/servicestack.client/index.json
GET https://api.nuget.org/v3-flatcontainer/servicestack.common/index.json
OK https://api.nuget.org/v3-flatcontainer/servicestack.client/index.json 158ms
GET https://api.nuget.org/v3-flatcontainer/servicestack.client/5.4.0/servicestack.client.5.4.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/servicestack.common/index.json 173ms
GET https://api.nuget.org/v3-flatcontainer/servicestack.common/5.4.0/servicestack.common.5.4.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/servicestack.client/5.4.0/servicestack.client.5.4.0.nupkg 148ms
OK https://api.nuget.org/v3-flatcontainer/servicestack.common/5.4.0/servicestack.common.5.4.0.nupkg 146ms
GET https://api.nuget.org/v3-flatcontainer/servicestack.text/index.json
OK https://api.nuget.org/v3-flatcontainer/servicestack.text/index.json 159ms
GET https://api.nuget.org/v3-flatcontainer/servicestack.text/5.4.0/servicestack.text.5.4.0.nupkg
OK https://api.nuget.org/v3-flatcontainer/servicestack.text/5.4.0/servicestack.text.5.4.0.nupkg 162ms
Committing restore...
Generating MSBuild file C:\Projects\Personal\POETS\POETS.ServiceModel\obj\POETS.ServiceModel.csproj.nuget.g.props.
Generating MSBuild file C:\Projects\Personal\POETS\POETS.ServiceModel\obj\POETS.ServiceModel.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Projects\Personal\POETS\POETS.ServiceModel\obj\project.assets.json
Restore completed in 1.79 sec for C:\Projects\Personal\POETS\POETS.ServiceModel\POETS.ServiceModel.csproj.
Installing ServiceStack.Text 5.4.0.
Installing ServiceStack.Client 5.4.0.
Installing ServiceStack.Common 5.4.0.
Installing ServiceStack 5.4.0.
Installing ServiceStack.Kestrel 5.4.0.
Committing restore...
Generating MSBuild file C:\Projects\Personal\POETS\POETS.ServiceInterface\obj\POETS.ServiceInterface.csproj.nuget.g.props.
Generating MSBuild file C:\Projects\Personal\POETS\POETS.ServiceInterface\obj\POETS.ServiceInterface.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Projects\Personal\POETS\POETS.ServiceInterface\obj\project.assets.json
Restore completed in 2.82 sec for C:\Projects\Personal\POETS\POETS.ServiceInterface\POETS.ServiceInterface.csproj.
Committing restore...
Generating MSBuild file C:\Projects\Personal\POETS\POETS.Tests\obj\POETS.Tests.csproj.nuget.g.props.
Generating MSBuild file C:\Projects\Personal\POETS\POETS.Tests\obj\POETS.Tests.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Projects\Personal\POETS\POETS.Tests\obj\project.assets.json
Restore completed in 2.84 sec for C:\Projects\Personal\POETS\POETS.Tests\POETS.Tests.csproj.
Committing restore...
Generating MSBuild file C:\Projects\Personal\POETS\POETS\obj\POETS.csproj.nuget.g.props.
Generating MSBuild file C:\Projects\Personal\POETS\POETS\obj\POETS.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Projects\Personal\POETS\POETS\obj\project.assets.json
Restore completed in 2.86 sec for C:\Projects\Personal\POETS\POETS\POETS.csproj.
NuGet Config files used:
C:\Projects\Personal\POETS\NuGet.Config
C:\Users\willi\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
https://api.nuget.org/v3/index.json
Installed:
1 package(s) to C:\Projects\Personal\POETS\POETS.ServiceModel\POETS.ServiceModel.csproj
5 package(s) to C:\Projects\Personal\POETS\POETS.ServiceInterface\POETS.ServiceInterface.csproj
6 package(s) to C:\Projects\Personal\POETS\POETS.Tests\POETS.Tests.csproj
5 package(s) to C:\Projects\Personal\POETS\POETS\POETS.csproj
Opened the App in Visual Studio 2017, and have a missing dependency for SharpPagesFeature.
public override void Configure(Container container)
{
Plugins.Add(new SharpPagesFeature()); // <--- Can't resolve this
SetConfig(new HostConfig
{
AddRedirectParamsToQueryString = true,
DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), false)
});
}
Does anyone know what package this is from? I see on GitHub that SharpPagesFeature is in the main namespace (ServiceStack).
EDIT
Additionally, the generated MyService.cs has incorrect dependencies and missing imports:
using ServiceStack.Script; <--- this can't be resolved and is unused
new PageResult(Request.GetPage("/")); <-- this requires me to import ServiceStack.Templates.PageResult (which resolves fine)
You have an old pre-release v5.4.1 of ServiceStack installed.
You'll need to clear your NuGet packages cache to install the latest version, e.g:
$ nuget locals all -clear

Resources