Related
I get this error when I try to deploy to Heroku :
[eslint] Failed to load config "airbnb" to extend from.
remote: Referenced from: /tmp/build_b7392388/client/.eslintrc.json
I have a client-server architecture that looks like this:
And in detail it looks like this:
Client part contains .eslintrc.json but the server part (root folder) does not.
Here is package.json from server (root folder):
{
"proxy": "http://localhost:3001",
"name": "emoteco_nodejs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"homepage": ".",
"scripts": {
"start": "node server/index.js",
"build": "cd client && npm install && npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"engines": {
"node": "14.17.5"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"applicationinsights": "^2.3.0",
"axios": "^0.27.2",
"azure-storage": "^2.10.7",
"express": "^4.17.2",
"gm": "^1.23.1",
"image-data-uri": "^2.0.1",
"jsonwebtoken": "^8.5.1",
"mongodb": "^4.2.2",
"multer": "^1.4.5-lts.1",
"node-cron": "^3.0.0",
"node-html-to-image": "^3.2.4",
"nodemailer": "^6.7.7",
"react-validation": "^3.0.7",
"validator": "^13.7.0"
},
"devDependencies": {
"sass": "^1.52.1"
}
}
Here is package.json from client (sub folder):
{
"name": "emotecoapp",
"version": "2.0.1",
"private": true,
"author": "Creative Tim",
"license": "See license in https://www.creative-tim.com/license",
"description": "Otis Kit PRO by Creative Tim",
"homepage": "",
"bugs": {
"url": "https://github.com/creativetimofficial/ct-otis-kit-pro/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/creativetimofficial/ct-otis-kit-pro.git"
},
"engines": {
"node": "14 || 15 || 16",
"npm": ">=6"
},
"dependencies": {
"#emotion/cache": "11.7.1",
"#emotion/react": "11.9.0",
"#emotion/styled": "11.8.1",
"#mui/icons-material": "5.6.2",
"#mui/material": "5.6.4",
"#mui/styled-engine": "5.6.1",
"#testing-library/jest-dom": "5.16.4",
"#testing-library/react": "13.2.0",
"#testing-library/user-event": "14.1.1",
"#types/jest": "^29.2.0",
"#types/node": "^18.11.7",
"#types/react": "^18.0.24",
"#types/react-dom": "^18.0.8",
"axios": "^1.1.3",
"chroma-js": "2.4.2",
"flatpickr": "4.6.13",
"onnxjs": "^0.1.8",
"prop-types": "15.8.1",
"react": "18.1.0",
"react-copy-to-clipboard": "5.1.0",
"react-countup": "6.2.0",
"react-dom": "18.1.0",
"react-flatpickr": "3.10.11",
"react-native-pytorch-core": "^0.2.2",
"react-router-dom": "6.3.0",
"react-scripts": "5.0.1",
"react-syntax-highlighter": "15.5.0",
"react-webcam": "^7.0.1",
"rellax": "1.12.1",
"swiper": "7.3.4",
"typed.js": "2.0.12",
"typescript": "^4.8.4",
"uuid": "8.3.2",
"web-vitals": "2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"eslint": "^8.2.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-react": "7.29.4",
"eslint-plugin-react-hooks": "4.5.0",
"prettier": "2.6.2"
}
}
I have tried several solutions like:
1.
npm install -g install-peerdeps
install-peerdeps --dev eslint-config-airbnb
install-peerdeps --dev eslint-config-airbnb-base
It didn't work.
2.
I also tried to change the setting.json of the VScode workspace like this:
{
"eslint.workingDirectories": [
"./client"
]
}
It didn't work as well
I have tried most of suggested solutions on internet but nothing works on my case.
Do you have any idea how I can solve my issue?
I'm getting the following error in my react project:
Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
React 2
useTheme useTheme.js:4
useTheme useThemeWithoutDefault.js:9
useTheme useTheme.js:7
Box createBox.js:22
React 17
js index.js:8
factory react refresh:6
Webpack 3
react.development.js:1447
React 2
useTheme useTheme.js:4
useTheme useThemeWithoutDefault.js:9
useTheme useTheme.js:7
Box createBox.js:22
React 17
js index.js:8
factory react refresh:6
Webpack 3
__webpack_require__
<anonymous>
<anonymous>
The project consists of 2 separate parts, Components and Onboarding. Onboarding uses Components as a dependency.
Inside Components, I have 2 package.json files, one in the root and one in src.
Root package.json:
{
"name": "My Project",
"version": "2.0.0",
"description": "Main React Library",
"main": "dist/index.js",
"module": "dist/index.js",
"bundleDependencies": false,
"deprecated": false,
"license": "MIT",
"private": true,
"sideEffects": false,
"scripts": {
"build": "rm -rf dist && NODE_ENV=production babel src --out-dir dist --copy-files"
},
"devDependencies": {
"#babel/cli": "^7.18.10",
"#babel/core": "^7.18.10",
"#babel/plugin-syntax-flow": "^7.18.6",
"#babel/polyfill": "^7.12.1",
"#babel/preset-env": "^7.18.10",
"#babel/preset-flow": "^7.18.6",
"#babel/preset-react": "^7.18.6",
"#types/node": "^18.7.15",
"typescript": "^4.8.2",
"reactstrap": "^9.1.4",
"react-quill": "^2.0.0"
},
"dependencies": {}
}
package.json inside src:
{
"name": "My Project",
"version": "2.0.0",
"description": "Main React Library",
"main": "index.js",
"module": "index.js",
"bundleDependencies": false,
"deprecated": false,
"license": "MIT",
"private": true,
"sideEffects": false,
"dependencies": {
"#mui/icons-material": "5.4.1",
"#mui/material": "5.4.1",
"#mui/styled-engine": "5.4.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-router-dom": "6.2.1",
"axios": "^0.27.2",
"uuid": "^9.0.0",
"bootstrap": "^5.2.0"
}
}
Inside Onboarding, I also have 2 package.json files, one in the root and one in src:
Root package.json:
{
"name": "onboarding-ui",
"description": "",
"version": "0.1.0",
"scripts": {
"start": "sls offline --aws-profile",
"deploy": "sls deploy -s stage --aws-profile",
"test": "sls invoke test"
},
"devDependencies": {
"aws-sdk-mock": "^5.7.0",
"serverless": "^3.21.0",
"serverless-cloudfront-invalidate": "^1.11.0",
"serverless-latest-layer-version": "^2.1.1",
"serverless-mocha-plugin": "^1.12.0",
"serverless-offline": "^6.8.0",
"serverless-prune-plugin": "^1.4.3",
"serverless-s3-sync": "^1.14.4",
"serverless-scriptable-plugin": "^1.0.5"
}
}
package.json inside src:
{
"name": "onboarding",
"version": "0.2.17",
"private": true,
"author": "Me",
"license": "MIT",
"description": "presentation layer.",
"engines": {
"node": "14 || 15 || 16",
"npm": ">=6"
},
"dependencies": {
"#asseinfo/react-kanban": "2.2.0",
"#emotion/cache": "11.7.1",
"#emotion/react": "11.7.1",
"#emotion/styled": "11.6.0",
"#mui/icons-material": "5.4.1",
"#mui/material": "5.4.1",
"#mui/styled-engine": "5.4.1",
"#mui/styles": "^5.9.2",
"#react-jvectormap/core": "1.0.1",
"#react-jvectormap/world": "1.0.0",
"#testing-library/jest-dom": "5.16.2",
"#testing-library/react": "12.1.2",
"#testing-library/user-event": "13.5.0",
"accounted-ui": "../../Components/dist",
"axios": "^0.27.2",
"chart.js": "3.4.1",
"chroma-js": "2.4.2",
"crypto-js": "^4.1.1",
"dropzone": "5.9.2",
"flatpickr": "4.6.9",
"formik": "^2.2.9",
"html-react-parser": "1.4.8",
"i18next": "^21.9.1",
"i18next-browser-languagedetector": "^6.1.5",
"i18next-http-backend": "^1.4.1",
"lodash.debounce": "^4.0.8",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-chartjs-2": "3.0.4",
"react-confetti": "^6.1.0",
"react-csv": "^2.2.2",
"react-debounce-input": "^3.3.0",
"react-dom": "17.0.2",
"react-flatpickr": "3.10.7",
"react-github-btn": "1.2.1",
"react-i18next": "^11.18.5",
"react-images-viewer": "1.7.1",
"react-quill": "1.3.5",
"react-router-dom": "6.2.1",
"react-scripts": "5.0.0",
"react-table": "7.7.0",
"react-toastify": "^9.0.3",
"stylis": "4.0.13",
"uuid": "8.3.2",
"web-vitals": "2.1.4",
"yup": "^0.32.11"
},
"scripts": {
"start": "react-scripts start",
"build:dev": "dotenv -e .env.dev react-scripts build",
"build:prod": "dotenv -e .env.prod react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install"
},
"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": {
"accounted-ui": "../../Components/dist", // this is how I'm pulling in the `Components` folder
"dotenv-cli": "^5.1.0",
"eslint": "8.8.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "4.3.0",
"prettier": "2.5.1"
}
}
The project is using Material UI, which I suspect might also have something to do with this. I tried many suggestions but nothing has worked so far. Would appreciate it if anyone can help with this.
Hi i have a server with multiple subdomain a weird issue started when all domains returned with 502 bad gateway i entered one subdomain and i run npm run dev and it worked but all the remain subdomains still 502, when i go to other subdomain and run npm start the subdomain work while all the other return 502 what should i do.
here's my package for web (on a subdomain)
{
"name": "mmy-route-web",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 8080",
"build": "next build",
"start": "next start"
},
"dependencies": {
"#fortawesome/free-solid-svg-icons": "^5.15.4",
"#fortawesome/react-fontawesome": "^0.1.16",
"#glidejs/glide": "^3.4.0",
"#mailchimp/mailchimp_marketing": "^3.0.43",
"#popperjs/core": "^2.9.2",
"#stripe/stripe-js": "^1.13.2",
"bootstrap": "^5.0.0-beta3",
"cloudinary-build-url": "^0.2.1",
"cloudinary-react": "^1.7.0",
"cookie": "^0.4.1",
"html-react-parser": "^1.2.6",
"lodash": "^4.17.21",
"next": "10.0.9",
"next-iron-session": "^4.1.12",
"nookies": "^2.5.2",
"npm": "^8.1.0",
"parse": "^3.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-use-tawk": "^1.0.0",
"sass": "^1.32.8",
"stripe": "^8.145.0",
"styled-components": "^5.2.1",
"swr": "^0.5.5"
},
"browser": {
"child_process": false
}
}
and for my backend (on other subdomain):
{
"name": "parse-server-example",
"version": "1.4.0",
"description": "An example Parse API server using the parse-server module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/"
},
"license": "MIT",
"dependencies": {
"#parse/fs-files-adapter": "^1.2.0",
"concurrently": "^7.0.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"jimp": "^0.16.1",
"kerberos": "0.0.24",
"nodemailer": "^6.4.17",
"parse": "~1.8.0",
"parse-dashboard": "^2.1.0",
"parse-server": "*",
"parse-server-cloudinary-adapter": "^1.4.0",
"parse-server-dedicated-email-adapter": "^3.0.6",
"parse-server-email-template-adapter": "^1.0.2",
"parse-server-generic-email-adapter": "0.0.4",
"parse-smtp-template": "^2.2.0",
"slugify": "^1.4.6"
},
"scripts": {
"start": "node index.js",
"dev": "concurrently \"cd server && npm run start\" \"npm run start\""
},
"engines": {
"node": ">=4.3"
}
}
Need help to start nodejs server and next js app at the same time using concurrently npm package at our backend. I have written the script in package.json file on backend side but it's not working.
I don't know exactly know even the concurrently is exist for next js or not. The below script is working fine for React-App but not working for Next JS App
package.json (backend)
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node backend/server",
"server": "nodemon backend/server",
"client": "npm start --prefix frontend",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
"author": "",
"license": "ISC",
"dependencies": {
"#sendgrid/mail": "^7.4.0",
"body-parser": "^1.19.0",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-jwt": "^6.0.0",
"express-validator": "^6.6.1",
"formidable": "^1.2.2",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.20",
"mongoose": "^5.10.9",
"morgan": "^1.10.0",
"nodemon": "^2.0.5",
"shortid": "^2.2.15",
"slugify": "^1.4.5",
"string-strip-html": "^6.1.0"
},
"devDependencies": {
"concurrently": "^5.3.0"
}
}
package.json(frontend)
{
"name": "frontend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"proxy": "http://127.0.0.1:8000",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "next",
"build": "next build",
"start": "next start"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#zeit/next-css": "^1.0.1",
"aos": "^3.0.0-beta.6",
"isomorphic-fetch": "^3.0.0",
"js-cookie": "^2.2.1",
"jsonwebtoken": "^8.5.1",
"moment": "^2.29.1",
"next": "^9.5.5",
"nprogress": "^0.2.0",
"prop-types": "^15.7.2",
"query-string": "^6.13.6",
"react": "^16.14.0",
"react-bootstrap": "^1.4.0",
"react-dom": "^16.14.0",
"react-modal": "^3.11.2",
"react-quill": "^1.3.5",
"react-render-html": "^0.6.0",
"reactstrap": "^8.6.0"
}
}
In your package.json file of the backend, you need to replace
"client": "npm start --prefix frontend",
with
"client": "cd ./frontend && npm run dev"
I am assuming that your Nextjs app is in the frontend folder/directory. change the folder accordingly. Then you can run npm run dev command from the backend directory.
Now you will be able to start nodejs server and next js app at the same time using concurrently npm package
To clarify the issue:
I have built a node server, which works fine. But on pushing to git and cloning elsewhere, it doesn't work in the new location.
Cleared node_modules, and tried npm install.
gitignore has only node_modules directory in it.
package.json contains the following
{
"name": "node-todo-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node server/server.js",
"test": "export NODE_ENV=test || SET NODE_ENV=test && mocha server/**/*.test.js",
"test-watch": "nodemon --exec 'npm test'"
},
"engines": {
"node": "6.2.2"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.15.2",
"express": "^4.14.0",
"jsonwebtoken": "^8.3.0",
"lodash": "^4.15.0",
"mongodb": "^2.2.5",
"mongoose": "^4.5.9",
"validator": "^5.6.0"
},
"devDependencies": {
"expect": "^1.20.2",
"mocha": "^5.2.0",
"nodemon": "^1.10.2",
"supertest": "^3.1.0"
}
}