Unable to deploy React project using XAMPP - reactjs

How can I build my project so I can put it wherever I want? For example, I would love to see it on, if it's possible, XAMPP?
Whenever I build my react app, index.html is empty.
Here is the whole project on GitHub: https://github.com/slabys/reacty.git
Whenever I use npm run build, my folder build is created with all the content:
index.html from build: https://pastebin.com/WSyAvrwu
package.json
{
"name": "my_react",
"version": "0.1.0",
"private": true,
"dependencies": {
"#stardust-ui/docs-components": "^0.40.0",
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"bootstrap": "^4.5.0",
"browser-sync": "^2.26.7",
"del": "^5.1.0",
"express": "^4.17.1",
"express-favicon": "^2.0.1",
"gulp-autoprefixer": "^7.0.1",
"gulp-concat": "^2.6.1",
"gulp-copy": "^4.0.1",
"gulp-data": "^1.3.1",
"gulp-plumber": "^1.2.1",
"gulp-sourcemaps": "^2.6.5",
"gulp-twig": "^1.2.0",
"prettier": "^1.4.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-sidebar": "^3.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
"main": "index.js",
"devDependencies": {
"#craco/craco": "^5.6.4",
"#semantic-ui-react/craco-less": "^1.2.1",
"gulp": "^4.0.2",
"gulp-sass": "^4.1.0",
"node-sass": "^4.14.1",
"semantic-ui-less": "^2.4.1"
},
"author": "slabys",
"license": "ISC",
"repository": {
"type": "git",
"url": "react"
},
"optionalDependencies": {}
}

Problem solved!
All works fine. Just when I have this projects build in XAMPP htdocs, I put in into a folder. So after moving files from folder directly under localhost EVERYTHING started to work.

Related

cloned project installation errors

I got this project from repo and cloned it using git clone
then I go to the directory in which I cloned it.
next I went to install the project using NPM install command and these errors occur:-
here is the JSON file
{
"name": "grocery-storeowner-frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"#material-ui/core": "^4.12.4",
"#material-ui/icons": "^4.11.3",
"#material-ui/lab": "^4.0.0-alpha.61",
"#react-pdf/renderer": "^3.0.0",
"#splinetool/react-spline": "^2.2.1",
"#splinetool/runtime": "^0.9.104",
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"firebase": "^9.9.4",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-datepicker": "^4.8.0",
"react-dom": "^18.2.0",
"react-image-file-resizer": "^0.4.8",
"react-image-gallery": "^1.2.9",
"react-modal-image": "^2.5.0",
"react-query": "^3.39.2",
"react-responsive-carousel": "^3.2.23",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-toastify": "^9.0.8",
"styled-components": "^5.3.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Any help would be appreciated.
my versions are:-
node.js :- v16.16.0
please change your node version to latest and try once hop it works .it seems you are using outdated node version to your current project.

Why is the build folder of my react app empty?

I am using create react app to make a react project.It is running without any problem on the localhost.However When I try to build it for production.The build takes like 5 minutes and then the build folder returned is completely empty.
I should say this now that the assets folder inside the app is like 50mb .So dont know if thats causing the issue.If anyone has any idea what might be the problem I will appreciate it.
package.json
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001",
"dependencies": {
"#amraneze/react-instagram-login": "^3.0.3",
"#emotion/react": "^11.9.0",
"#emotion/styled": "^11.8.1",
"#fortawesome/fontawesome-svg-core": "^6.1.1",
"#fortawesome/free-brands-svg-icons": "^6.1.1",
"#fortawesome/free-solid-svg-icons": "^6.1.1",
"#fortawesome/react-fontawesome": "^0.1.18",
"#mui/material": "^5.6.3",
"#reduxjs/toolkit": "^1.8.1",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.1.1",
"#testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"jquery": "^3.6.0",
"puppeteer": "^14.1.0",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-dropzone": "^14.2.1",
"react-fontawesome": "^1.7.1",
"react-google-login": "^5.2.2",
"react-redux": "^7.2.6",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-slick": "^0.29.0",
"redux": "^4.1.2",
"slick-carousel": "^1.8.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

localhost not working after save in VS Code

Currently working on a project, the project works perfectly fine after npm start and can function normally. However, after any changes made in VS Code, it seems localhost not listening any changes anymore. The workaround is to refresh the browser anytime changes has been made. Does anyone have experienced above issue?
I have tried to remove package-lock.json and node_modules, re-install packages by npm install, nothing helped.
Here is my package.json
{
"name": "crypto-dashboard",
"version": "0.1.0",
"private": true,
"homepage": "https://nickng852.github.io/crypto-dashboard/",
"dependencies": {
"#craco/craco": "^6.3.0",
"#reduxjs/toolkit": "^1.7.1",
"#testing-library/jest-dom": "^5.14.1",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"autoprefixer": "^9.8.7",
"axios": "^0.22.0",
"chart.js": "^3.6.0",
"firebase": "^9.1.2",
"html-react-parser": "^1.4.2",
"millify": "^4.0.0",
"moment": "^2.29.1",
"node-sass": "^6.0.1",
"postcss": "^7.0.38",
"react": "^17.0.2",
"react-chartjs-2": "^3.3.0",
"react-click-away-listener": "^2.0.5",
"react-dom": "^17.0.2",
"react-redux": "^7.2.6",
"react-router-dom": "^6.2.2",
"react-scripts": "4.0.3",
"redux": "^4.1.2",
"tailwindcss": "npm:#tailwindcss/postcss7-compat#^2.2.16",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject",
"predeploy": "npm run build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

How to fix-h -t ssh://git#github.com/ethereumjs/ethereumjs-abi.git

Up to 2 days ago I could install all dependencies of my project without any problem, but since today I am getting this ssh error:
-h -t ssh://git#github.com/ethereumjs/ethereumjs-abi.git
but the thing is that I do not have ethereumjs installed.
Here is my package.json
{
"name": "husky-farm",
"version": "0.1.0",
"private": true,
"dependencies": {
"#ethersproject/providers": "^5.4.1",
"#material-ui/core": "^4.11.4",
"#material-ui/icons": "^4.11.2",
"#material-ui/lab": "^4.0.0-alpha.60",
"#testing-library/jest-dom": "^5.12.0",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"#walletconnect/web3-provider": "^1.4.1",
"#web3-react/core": "^6.1.9",
"#web3-react/injected-connector": "^6.0.7",
"flag-icon-css": "^3.5.0",
"i18next": "^20.3.1",
"i18next-browser-languagedetector": "^6.1.1",
"i18next-http-backend": "^1.2.6",
"npm": "^7.19.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^11.10.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-stepper-horizontal": "^1.0.11",
"web-vitals": "^1.1.2",
"web3": "^1.3.6"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"bignumber.js": "^9.0.1",
"dotenv-cli": "^4.0.0",
"eslint": "^7.30.0",
"eslint-plugin-react": "^7.24.0",
"ethers": "^5.4.1"
}
}
Any idea why all of sudden it asks me an ssh key?
Check first, as mentioned in the comments of this question, if updating node and npm to the latest version.
As seen in smartcontractkit/truffle-starter-kit issue 96, consider also using yarn, to test if this is more reliable than npm in your case.

electron and react with expressjs build issues

I have an app almost ready to package, I've been using express, react, bootstrap and electron. I can run the app file using npm start, But i cant package it. Build completes and when i run application file electron open but neither react runs on localhost nor express.
My directory structure is as follows
- api
- containes expressjs (package.json)
- client
- containes react and electron (package.json)
*let me know if you need more detailed structure
This is my procfile
react: npm run react-start
electron: npm run electron-start
express: npm start --prefix ../api/
This is my package.json
{
"name": "POSifier",
"version": "0.1.0",
"description": "system",
"private": true,
"homepage": "../",
"dependencies": {
"#date-io/date-fns": "^1.3.13",
"#material-ui/core": "^4.11.0",
"#material-ui/icons": "^4.9.1",
"#material-ui/pickers": "^3.2.10",
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"#wojtekmaj/react-datetimerange-picker": "^3.0.0",
"bootstrap": "^4.5.2",
"canvasjs": "^1.8.3",
"custom-electron-titlebar": "^3.2.5",
"date-fns": "^2.16.1",
"jquery": "^3.5.1",
"jsbarcode": "^3.11.3",
"moment": "^2.29.1",
"mysql": "^2.18.1",
"pouchdb": "^7.2.2",
"pouchdb-authentication": "^1.1.3",
"pouchdb-browser": "^7.2.2",
"pouchdb-find": "^7.2.2",
"pouchdb-react-native": "^6.4.1",
"react": "^16.13.1",
"react-bootstrap": "^1.3.0",
"react-bootstrap-date-picker": "^5.1.0",
"react-dom": "^16.13.1",
"react-fade-in": "^1.1.1",
"react-native": "^0.63.2",
"react-pouchdb": "^2.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"web-vitals": "^0.2.4"
},
"build": {
"appId": "com.Posifier.app",
"files": [
"build/**/*",
"node_modules/**/*"
],
"directories": {
"buildResources": "assets"
}
},
"scripts": {
"start": "nf start -p 3000",
"electron-start": "node src/wait-for-react",
"electron-pack": "build --em.main=build/electron.js",
"preelectron-pack": "yarn build",
"react-start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"electron": "electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder",
"new":"react-scripts build && electron-builder --publish=always"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"electron": "^11.1.1",
"electron-builder": "^22.9.1",
"foreman": "^3.0.1"
},
"main": "public/electron.js"
}

Resources