0

I have been through all the similar questions on stackoverflow and also viewed several other source, yet I can't solve this issue for some reason.

On my React JS app I get the error messages as shown in the screenshot below. I am using react-app-rewired, but all the solutions with putting a config-override file in my rootfolder don't seem to work. In the other screenshot you can see all the files in the rootfolder.

I guess you will need more information to properly see what I am doing wrong. The config-overrides file is located in the node-modules/react-app-rewired folder.

This is the content of my config-overrides.js

const {paths} = require('./');
// load environment variables from .env files
// before overrides scripts are read
require(paths.scriptVersion + '/config/env');
const override = require(paths.configOverrides);

const webpack = typeof override === 'function'
  ? override
  : override.webpack || ((config, env) => config);

if (override.devserver) {
  console.log(
    'Warning: `devserver` has been deprecated. Please use `devServer` instead as ' +
    '`devserver` will not be used in the next major release.'
  )
}

const devServer = override.devServer || override.devserver
  || ((configFunction) =>
    (proxy, allowedHost) =>
      configFunction(proxy, allowedHost));

const jest = override.jest || ((config) => config);

const pathsOverride = override.paths || ((paths, env) => paths);

// normalized overrides functions
module.exports = {
  webpack,
  devServer,
  jest,
  paths: pathsOverride
};

this is the content of my package.json

{
    "name": "fuse-react-app",
    "version": "8.2.1",
    "private": true,
    "dependencies": {
        "@date-io/date-fns-jalali": "2.15.0",
        "@emotion/cache": "11.9.3",
        "@emotion/react": "11.9.3",
        "@emotion/styled": "11.9.3",
        "@fullcalendar/daygrid": "5.11.2",
        "@fullcalendar/interaction": "5.11.2",
        "@fullcalendar/react": "5.11.2",
        "@fullcalendar/timegrid": "5.11.2",
        "@googleapis/docs": "^1.0.1",
        "@hookform/resolvers": "2.9.7",
        "@mui/base": "5.0.0-alpha.93",
        "@mui/icons-material": "5.8.4",
        "@mui/lab": "5.0.0-alpha.95",
        "@mui/material": "5.10.1",
        "@mui/styles": "5.9.3",
        "@mui/system": "5.10.1",
        "@mui/utils": "5.9.3",
        "@mui/x-data-grid": "5.15.2",
        "@mui/x-date-pickers": "5.0.0-beta.6",
        "@react-pdf/renderer": "^3.0.0",
        "@reduxjs/toolkit": "1.8.5",
        "apexcharts": "3.35.4",
        "autosuggest-highlight": "3.3.4",
        "axios": "0.27.2",
        "axios-mock-adapter": "1.21.2",
        "browserify-zlib": "^0.2.0",
        "clsx": "1.2.1",
        "core-js": "3.24.1",
        "crypto-js": "4.1.1",
        "date-fns": "2.29.1",
        "date-fns-jalali": "2.21.3-1",
        "draft-js": "0.11.7",
        "draftjs-to-html": "0.9.1",
        "firebase": "^9.10.0",
        "framer-motion": "7.2.0",
        "fs": "^0.0.1-security",
        "google-map-react": "2.2.0",
        "googleapis": "^108.0.0",
        "history": "5.3.0",
        "i18next": "21.9.1",
        "jwt-decode": "3.1.2",
        "keycode": "2.2.1",
        "lodash": "4.17.21",
        "marked": "4.0.18",
        "material-ui-popup-state": "2.0.1",
        "mobile-detect": "1.4.5",
        "mobx": "^6.6.1",
        "moment": "2.29.4",
        "net": "^1.0.2",
        "notistack": "1.0.6-next.3",
        "os": "^0.1.2",
        "perfect-scrollbar": "1.5.5",
        "prismjs": "1.28.0",
        "prop-types": "15.8.1",
        "qs": "6.11.0",
        "raw-loader": "4.0.2",
        "react": "18.2.0",
        "react-apexcharts": "1.4.0",
        "react-autosuggest": "10.1.0",
        "react-beautiful-dnd": "13.1.0",
        "react-dom": "18.2.0",
        "react-draft-wysiwyg": "1.15.0",
        "react-draggable": "4.4.5",
        "react-hook-form": "7.34.2",
        "react-i18next": "11.18.4",
        "react-imask": "6.4.2",
        "react-masonry-css": "1.0.16",
        "react-number-format": "4.9.3",
        "react-pdf": "^5.7.2",
        "react-popper": "2.3.0",
        "react-redux": "8.0.2",
        "react-router-dom": "6.3.0",
        "react-spring": "8.0.27",
        "react-swipeable": "7.0.0",
        "react-swipeable-views": "0.14.0",
        "react-swipeable-views-utils": "0.14.0",
        "react-table": "7.8.0",
        "react-transition-group": "4.4.5",
        "react-virtualized": "9.22.3",
        "react-window": "1.8.7",
        "redoc": "2.0.0-rc.76",
        "redux-logger": "4.0.0",
        "stream": "^0.0.2",
        "styled-components": "5.3.5",
        "stylis": "4.1.1",
        "stylis-plugin-rtl": "2.1.1",
        "tls": "^0.0.1",
        "tools": "^0.0.0",
        "web-vitals": "2.1.4",
        "yup": "0.32.11",
        "zlib": "^1.0.5"
    },
    "peerDependencies": {
        "autoprefixer": "10.4.7",
        "postcss": "8.4.13",
        "react": "18.2.0",
        "react-dom": "18.2.0"
    },
    "resolutions": {
        "react": "18.2.0",
        "react-dom": "18.2.0",
        "babel-loader": "8.1.0"
    },
    "devDependencies": {
        "@babel/core": "7.17.10",
        "@babel/eslint-parser": "7.17.0",
        "@babel/node": "7.17.10",
        "@babel/preset-env": "7.17.10",
        "@babel/preset-react": "7.16.7",
        "@tailwindcss/aspect-ratio": "^0.4.0",
        "@tailwindcss/line-clamp": "^0.4.0",
        "@tailwindcss/typography": "^0.5.4",
        "@typescript-eslint/eslint-plugin": "^4.33.0",
        "@typescript-eslint/parser": "^4.33.0",
        "assert": "^2.0.0",
        "autoprefixer": "9.8.8",
        "buffer": "^6.0.3",
        "cross-env": "7.0.3",
        "crypto-browserify": "^3.12.0",
        "eslint": "7.32.0",
        "eslint-config-airbnb": "^18.2.1",
        "eslint-config-prettier": "^8.3.0",
        "eslint-config-react-app": "^6.0.0",
        "eslint-plugin-flowtype": "^5.10.0",
        "eslint-plugin-import": "^2.25.2",
        "eslint-plugin-jsx-a11y": "^6.4.1",
        "eslint-plugin-prettier": "^4.0.0",
        "eslint-plugin-react": "^7.26.1",
        "eslint-plugin-react-hooks": "^4.2.0",
        "eslint-plugin-unused-imports": "^1.1.5",
        "https-browserify": "^1.0.0",
        "immutable": "4.0.0",
        "js-beautify": "1.14.0",
        "os-browserify": "^0.3.0",
        "postcss": "8.4.5",
        "prettier": "^2.4.1",
        "process": "^0.11.10",
        "promise": "8.1.0",
        "react-app-alias": "2.2.0",
        "react-app-rewired": "^2.2.1",
        "react-scripts": "5.0.1",
        "source-map-explorer": "2.5.2",
        "stream-browserify": "^3.0.0",
        "stream-http": "^3.2.0",
        "tailwindcss": "3.1.8",
        "typescript": "4.6.4",
        "url": "^0.11.0",
        "util": "^0.12.5"
    },
    "scripts": {
        "start": "react-app-rewired start",
        "build": "cross-env GENERATE_SOURCEMAP=false react-app-rewired build",
        "test": "react-app-rewired test --env=node",
        "eject": "react-app-rewired eject",
        "build-docs": "babel-node --presets @babel/preset-env src/app/main/documentation/material-ui-components/build.js",
        "analyze": "react-app-rewired build && source-map-explorer 'build/static/js/*.js' --html analyze-result.html",
        "lint": "eslint"
    },
    "engines": {
        "node": ">=14.0.0",
        "npm": ">=7.0.0"
    },
    "browserslist": {
        "production": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ],
        "development": [
            "last 1 chrome version",
            "last 1 firefox version",
            "last 3 safari version"
        ]
    }
}

enter image description here enter image description here

Emo Flore
  • 21
  • 4
  • You are trying to use backend modules on frontend. Show your `package.json` – Konrad Oct 25 '22 at 06:32
  • 1
    [Please do not upload images of code/data/errors when asking a question.](//meta.stackoverflow.com/q/285551) – Thomas Oct 25 '22 at 06:35
  • @KonradLinkowski I have added the package.json contents, does this clarify the issue for you? – Emo Flore Oct 25 '22 at 09:55
  • 1
    Yes, [googlepais](https://www.npmjs.com/package/googleapis) is a nodejs library but you are trying to use it on the client side. You can't do that – Konrad Oct 25 '22 at 10:41

1 Answers1

-1

The error message is telling you what you need to do. You must add the config override AND also manually install the missing package. Post the contents of your override file and package.json.

Mani Gandham
  • 7,688
  • 1
  • 51
  • 60
  • Hi Mani, thanks for your reply, I edited my question with the package.json and content of the override file. Is this helpful? Like I said before, I have tried to do the exact things in the error messages yet, it keeps showing these error messages. – Emo Flore Oct 25 '22 at 07:09