I deployed react to vercel, but only a blank screen appears - javascript

I used react as frontend and firebase as backend.
And it succeeded in deploying to vercel.
But it just shows a blank screen.
And when I go to the console, this error code appears.
Uncaught FirebaseError: Firebase: Error (auth/invalid-api-key)
my repo: https://github.com/kagrin97/fireBase-twitter
package.json
{
"name": "firebase-twitter",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"#types/jest": "^27.5.2",
"#types/node": "^16.11.43",
"#types/react": "^18.0.15",
"#types/react-dom": "^18.0.6",
"firebase": "^9.8.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"typescript": "^4.7.4",
"uuid": "^8.3.2",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"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": {
"#types/uuid": "^8.3.4",
"autoprefixer": "^10.4.7",
"gh-pages": "^4.0.0",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.5"
},
"homepage": "."
}

Related

ReactJS Application is not working in old chrome 27 version

I have created fresh ReactJS project using create-react-app,
used node Version : 12.22.12,
To make compactable for older version browser I have used polyfill core-js,
after using polyfill now it working in chrome 31 version onwards. It is not working in chrome 27 to 30. Getting error:- Uncaught SyntaxError: Unexpected token )
package.json file
{
"name": "xyz",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"core-js": "^3.25.0",
"grommet": "^2.25.0",
"grommet-controls": "^3.0.2",
"grommet-icons": "^4.7.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"regenerator-runtime": "^0.13.9",
"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"
]
},
"devDependencies": {
"compression-webpack-plugin": "^10.0.0",
"mini-css-extract-plugin": "^2.6.1",
"webpack-bundle-analyzer": "^4.5.0"
}
}
Another method which I have tried
I have created ReactJS project using Webpack,
used node Version : 12.22.12,
This is not working in older version of chrome,
Getting Error:- Uncaught SyntaxError: Unexpected token )
package.json file
{
"name": "xyz",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack serve --mode development",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/core": "^7.18.10",
"#babel/preset-env": "^7.18.10",
"#babel/preset-react": "^7.18.6",
"babel-loader": "^8.2.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"css-loader": "^6.7.1",
"html-webpack-plugin": "^5.5.0",
"style-loader": "^3.3.1",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.3"
},
"dependencies": {
"#babel/polyfill": "^7.12.1",
"core-js": "^3.25.1",
"grommet": "^2.25.1",
"grommet-controls": "^3.0.2",
"grommet-icons": "^4.7.0",
"node-polyfill-webpack-plugin": "^2.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"regenerator-runtime": "^0.13.9",
"styled-components": "^5.3.5"
}
}
It's rather related to create-react-app
Please follow this guide
The first thing you can do is change browserlist, because now you only support the newest browsers with your configuration
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
But I doubt you can run React on a browser from 2013.

cannot read property name ; tagName null, while using svg

It's a duplicate question on SVG, but maybe my scenario is different, I am not able to understand any solution on the web for my problem which is, getting below error
ERROR in ./src/Utility/assets/customer-delight-logo.svg
Module build failed (from ./node_modules/#svgr/webpack/lib/index.js):
TypeError: Cannot read properties of null (reading 'tagName')
at parse (C:\Customer delight\customerdelight\node_modules\svg-parser\dist\svg-parser.umd.js:279:15)......
my package.json contains
{
"name": "customerdelight",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"bootstrap": "^4.6.1",
"html-webpack-plugin": "^5.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"dev": "webpack serve"
},
"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": {
"#babel/core": "^7.18.9",
"#babel/preset-env": "^7.18.9",
"#babel/preset-react": "^7.18.6",
"babel-loader": "^8.2.5",
"cors": "^2.8.5",
"express": "^4.18.1",
"file-loader": "^6.2.0",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.3"
}
}
this is my code
import Logo from '../../Utility/assets/customer-delight-logo.svg';
export default function Logocomp(){
return(
<div className="rad-logo-container">
<img src={Logo} alt="" height="50" width="140"/>
</div>
)
}
Thanks in advance!
Try to update your webpack configuration to handle loading svg files. inside the module.rules array you should add the following:
{
test: /\.(png|svg)$/,
use: ['file-loader']
}

Error: Conversion from 'BigInt' to 'number' is not allowed on react build script

I've developed UI using create-react-app. UI is working fine with the normal npm start command, but when I build the UI with npm run build it's throwing the error `Conversion from 'BigInt' to 'number' is not allowed
I didn't get many related solutions to my problem on google. Can someone help please ?
My Package.json
{
"name": "erp-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.36",
"#fortawesome/free-solid-svg-icons": "^5.15.4",
"#fortawesome/react-fontawesome": "^0.1.15",
"#popperjs/core": "^2.10.2",
"#testing-library/jest-dom": "^5.14.1",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"axios": "^0.22.0",
"bootstrap": "^5.0.1",
"font-awesome": "^4.7.0",
"jsontokens": "^3.1.1",
"react": "^17.0.2",
"react-datepicker": "^4.8.0",
"react-dom": "^17.0.2",
"react-hook-form": "^7.17.0",
"react-paginate": "^7.1.3",
"react-router": "^5.2.1",
"react-router-dom": "^5.3.0",
"react-scripts": "^4.0.3",
"react-toastify": "^8.0.3",
"web-vitals": "^1.1.2"
},
"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"
]
}
}
Error screenshot which is point in browser

import my local react package in an electron app

I have a react app , I packaged it using npm pack and I want to use it inside the main.ts in an electron app ,
I'm trying to import it like this import App from 'mypackage' but it keeps giving me this error
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\node_modules\mypackage\src\index.js from C:\src\main\main.ts not supported.
Instead change the require of index.js in C:\src\main\main.ts to a dynamic import() which is available in all CommonJS modules.
in my json file
{
"name": "mypackage",
"version": "0.1.0",
"main":"src/index.js",
"private": true,
"dependencies": {
"#blueprintjs/core": "^3.52.0",
"#blueprintjs/popover2": "^0.12.9",
"#rimbu/core": "^0.8.4",
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"#types/jest": "^26.0.15",
"#types/node": "^12.0.0",
"#types/react": "^17.0.37",
"#types/react-beautiful-dnd": "^13.1.2",
"#types/react-dom": "^17.0.11",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-icons": "^4.3.1",
"react-scripts": "4.0.3",
"react-table": "^7.7.0",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1"
},
"type" : "module",
"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": {
"#types/react-table": "^7.7.9",
"sass": "^1.45.1"
}
}

Property 'context' does not exist on type 'NodeRequire'. TS2339

I can't clear this error. I've installed and reinstalled webpack types but can't figure out how to make this work. Is there a way to clear or bypass this error?
Error
TypeScript error in /app/src/components/MoviePage/MoviePage.tsx(9,11):
Property 'context' does not exist on type 'NodeRequire'. TS2339
Code with error
const movieThumbImages = importAll(
require.context("../../assets/moviePosterImages", false, /\.(png|jpe?g|svg)$/)
);
Function
export const importAll = (r: any) => {
return r.keys().map(r);
};
package.json
{
"name": "movie-hunt",
"version": "0.1.0",
"private": true,
"dependencies": {
"#types/jest": "^26.0.24",
"#types/node": "^12.20.20",
"#types/react": "^17.0.19",
"#types/react-dom": "^17.0.9",
"#types/react-router": "^5.1.16",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"typescript": "^4.3.5",
"web-vitals": "^1.1.2"
},
"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": {
"#testing-library/jest-dom": "^5.14.1",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^12.8.3",
"#types/react-router-dom": "^5.1.8",
"#types/webpack-env": "^1.16.2",
"webpack-env": "^0.8.0"
}
}

Categories

Resources