Getting version conflicts when trying to add dependencies in my django-react project
Actually i am trying to add some more dependencies like the react-pdf etc. in my project which is a django project and i am trying to use react elements too along with it. I am using the webpack to present my react code to my django using npm build and start webpack commands, which is giving me a build file which is accepted my django project.
So far I know that the react elements (packages and dependencies ) are dependent on a package.json file which gives a list of the files that are required or installed in the system according to requirements . If i use the " npm install" than it searches for the package.json file and than the package-lock.json file to install the required mentioned packages and dependencies.
Now, I have even removed the node_modules file (which contains all the installed dependencies) and the package-lock.json file too, and just have the package.json file , if i try to install the dependencies now , than it giving me a no. of version conflicts among the packages/library names listed in package.json file .
The main issue is the project is already running without any errors in deployment and now when i try to add any other dependency than it is showing version conflict the already running project.
I tried removing the package-lock.json file and the node_modules folder too, for a fresh installation of packages/dependencies but it still got errors. I've tried editing the package.json files to match the version requirements but still it got issues.
Here is my package.json file :
{
"name": "u4rad-report",
"version": "1.0.0",
"private": true,
"homepage": "http://34.93.156.210/report",
"main": "index.js",
"dependencies": {
"@babel/core": "^7.16.0",
"@ckeditor/ckeditor5-build-decoupled-document": "^27.1.0",
"@ckeditor/ckeditor5-react": "^1.1.0",
"@jsonforms/core": "^2.5.2",
"@jsonforms/material-renderers": "^2.5.0",
"@jsonforms/react": "^3.2.1",
"@jsonforms/vanilla-renderers": "^2.5.0",
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@svgr/webpack": "^5.5.0",
"axios": "^1.6.7",
"babel-jest": "^27.4.2",
"babel-loader": "^8.2.3",
"babel-plugin-named-asset-import": "^0.3.8",
"babel-preset-react-app": "^10.0.1",
"bfj": "^7.0.2",
"bootstrap": "^4.6.0",
"browserslist": "^4.18.1",
"camelcase": "^6.2.1",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"cors": "^2.8.5",
"css-loader": "^6.5.1",
"css-minimizer-webpack-plugin": "^3.2.0",
"dotenv": "^10.0.0",
"dotenv-expand": "^5.1.0",
"eslint": "^8.3.0",
"eslint-config-react-app": "^7.0.1",
"eslint-webpack-plugin": "^3.1.1",
"express": "^4.17.1",
"file-loader": "^6.2.0",
"fs-extra": "^10.0.0",
"googleapis": "^122.0.0",
"html-webpack-plugin": "^5.5.0",
"html2pdf.js": "^0.10.1",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.4.3",
"jest-resolve": "^27.4.2",
"jest-watch-typeahead": "^1.0.0",
"jquery": "^3.6.0",
"mini-css-extract-plugin": "^2.4.5",
"popper": "^1.0.1",
"postcss": "^8.4.4",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-loader": "^6.2.1",
"postcss-normalize": "^10.0.1",
"postcss-preset-env": "^7.0.1",
"prompts": "^2.4.2",
"query-string": "^4.3.4",
"react": "16.8.0",
"react-app-polyfill": "^3.0.0",
"react-bootstrap4-modal": "^1.7.5",
"react-dev-utils": "^12.0.1",
"react-dom": "16.8.0",
"react-refresh": "^0.11.0",
"react-share": "^4.4.1",
"resolve": "^1.20.0",
"resolve-url-loader": "^4.0.0",
"sass-loader": "^12.3.0",
"semver": "^7.3.5",
"sequelize": "^6.6.2",
"source-map-loader": "^3.0.0",
"sqlite3": "^5.0.2",
"style-loader": "^3.3.1",
"tailwindcss": "^3.0.2",
"terser-webpack-plugin": "^5.2.5",
"webpack-dev-server": "^4.6.0",
"webpack-manifest-plugin": "^4.0.2",
"workbox-webpack-plugin": "^6.4.1"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom",
"build:webpack": "webpack --mode=production",
"start:webpack": "webpack --watch",
"dev:webpack": "webpack --mode=development"
},
"devDependencies": {
"@babel/core": "^7.18.6",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@babel/runtime": "^7.15.3",
"@emotion/babel-plugin": "^11.3.0",
"assert": "^2.0.0",
"autoprefixer": "^10.3.4",
"babel-loader": "^8.2.5",
"buffer": "^6.0.3",
"crypto": "npm:crypto-browserify",
"crypto-browserify": "^3.12.0",
"css-loader": "^6.2.0",
"https-browserify": "^1.0.0",
"json-loader": "^0.5.7",
"node-sass": "^6.0.1",
"os-browserify": "^0.3.0",
"postcss": "^8.3.6",
"postcss-loader": "^6.1.1",
"resolve-cwd": "^3.0.0",
"sass-loader": "^12.1.0",
"stream": "npm:stream-browserify",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"style-loader": "^3.2.1",
"webpack": "^5.91.0",
"webpack-cli": "^4.8.0"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"jest": {
"roots": [
"/src"
],
"collectCoverageFrom": [
"src//*.{js,jsx,ts,tsx}",
"!src//.d.ts"
],
"setupFiles": [
"react-app-polyfill/jsdom"
],
"setupFilesAfterEnv": [],
"testMatch": [
"/src//tests//.{js,jsx,ts,tsx}",
"/src/**/.{spec,test}.{js,jsx,ts,tsx}"
],
"testEnvironment": "jsdom",
"transform": {
"^.+\.(js|jsx|mjs|cjs|ts|tsx)$": "/config/jest/babelTransform.js",
"^.+\.css$": "/config/jest/cssTransform.js",
"^(?!.\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\]node_modules[/\\].+\.(js|jsx|mjs|cjs|ts|tsx)$",
"^.+\.module\.(css|sass|scss)$"
],
"modulePaths": [],
"moduleNameMapper": {
"^react-native$": "react-native-web",
"^.+\.module\.(css|sass|scss)$": "identity-obj-proxy"
},
"moduleFileExtensions": [
"web.js",
"js",
"web.ts",
"ts",
"web.tsx",
"tsx",
"json",
"web.jsx",
"jsx",
"node"
],
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
],
"resetMocks": true
},
"eslintConfig": {
"extends": "react-app"
}
}
and here is one of my errors when i try to add a new dependency or install the previous one's again:
(env) PS E:\ReportingBot\env\Reporting-Bot-main\authsysproject\JS> npm install
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @jsonforms/react@2.5.2
npm error Found: react@16.8.0
npm error node_modules/react
npm error react@"16.8.0" from the root project
npm error peer react@"^16.0.0" from @ckeditor/ckeditor5-react@1.1.3
npm error node_modules/@ckeditor/ckeditor5-react
npm error @ckeditor/ckeditor5-react@"^1.1.0" from the root project
npm error 11 more (@material-ui/core, @material-ui/icons, ...)
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.12.0 || ^17.0.0" from @jsonforms/react@2.5.2
npm error node_modules/@jsonforms/react
npm error @jsonforms/react@"^2.5.0" from the root project
npm error peer @jsonforms/react@"^2.5.2" from @jsonforms/material-renderers@2.5.2
npm error node_modules/@jsonforms/material-renderers
npm error @jsonforms/material-renderers@"^2.5.0" from the root project
npm error 1 more (@jsonforms/vanilla-renderers)
npm error
npm error Conflicting peer dependency: react@17.0.2
npm error node_modules/react
npm error peer react@"^16.12.0 || ^17.0.0" from @jsonforms/react@2.5.2
npm error node_modules/@jsonforms/react
npm error @jsonforms/react@"^2.5.0" from the root project
npm error peer @jsonforms/react@"^2.5.2" from @jsonforms/material-renderers@2.5.2
npm error node_modules/@jsonforms/material-renderers
npm error @jsonforms/material-renderers@"^2.5.0" from the root project
npm error 1 more (@jsonforms/vanilla-renderers)
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\Users\admin\AppData\Local\npm-cache_logs\2024-08-27T08_32_31_482Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\admin\AppData\Local\npm-cache_logs\2024-08-27T08_32_31_482Z-debug-0.log
(env) PS E:\ReportingBot\env\Reporting-Bot-main\authsysproject\JS>
Even when i try to do fix the version in the package.json file than it gives a conflict in the version of some other requirement and then some else and so on . But i don't know how it is perfectly working in a currently deployed project. Thanks in advance if any person is able to help me in this case , and if someone understood my actual issue.