In the browser, I get the error:
Failed to compile ./src/components/layout/search/Searchbar.js Module not found: Can't resolve './node_modules/@material-ui/core/IconButton' in 'C:\Users\Ja\Desktop\INFA\ProjektInzynierski\Projekt\Engineering-Project\client\src\components\layout\search'
Console error:
map-contours.js:16 Uncaught Error: Cannot find module './node_modules/react' at webpackMissingModule (map-contours.js:16) at Module../src/components/layout/search/Searchbar.js (map-contours.js:16) at webpack_require (bootstrap:785) at fn (bootstrap:150) at Module../src/components/layout/map/Map2.js (Navbar.js:13) at webpack_require (bootstrap:785) at fn (bootstrap:150) at Module../src/App.js (App.css?498e:37) at webpack_require (bootstrap:785) at fn (bootstrap:150) at Module../src/index.js (custom-mapbox-gl.css?2ca8:37) at webpack_require (bootstrap:785) at fn (bootstrap:150) at Object.0 (serviceWorker.js:135) at webpack_require (bootstrap:785) at checkDeferredModules (bootstrap:45) at Array.webpackJsonpCallback [as push] (bootstrap:32) at main.chunk.js:1
The issue occurred after I changed the file "Searchbar.js" location from layout dir to layout/search dir.
It seems that compiler is searching for '@material-ui/core/IconButton' in 'C:\Users\Ja\Desktop\INFA\ProjektInzynierski\Projekt\Engineering-Project\client\src\components\layout\search'.
What have I already tried to solve this problem (random order):
1) Reinstall @material-ui/core
2) yarn add @material-ui/core
3) yarn add @material-ui/core@next
4) update npm install react react-dom
5) npm uninstall @material-ui/core, and install @material-ui/core
6) delete whole node_modules and npm install
7) clean all @material-ui from yarn.lock, package-lock.json, and install needed package after.
Nothing worked.
My package.json:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.0.0-rc.0",
"@material-ui/icons": "^4.4.3",
"d3-request": "^1.0.6",
"immutable": "^4.0.0-rc.12",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-map-gl": "^5.0.11",
"react-scripts": "3.1.1"
},
"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"
]
}
}
The Component code:
import React from './node_modules/react';
import { makeStyles } from './node_modules/@material-ui/core/styles';
import Paper from './node_modules/@material-ui/core/Paper';
import InputBase from './node_modules/@material-ui/core/InputBase';
import IconButton from './node_modules/@material-ui/core/IconButton';
import SearchIcon from './node_modules/@material-ui/icons/Search';
const useStyles = makeStyles(theme => ({
}));
function searchMetchod() {
}
export default function CustomizedInputBase() {
const classes = useStyles();
return (
<Paper className={classes.root}>
<InputBase
className={classes.input}
placeholder="Szukaj Nazwisk"
inputProps={{ 'aria-label': 'search google maps' }}
/>
<IconButton className={classes.iconButton} aria-label="search" onClick={searchMetchod}>
<SearchIcon />
</IconButton>
</Paper>
);
}
it seems that the problem affects the whole @material-ui/core package not only the 'IconButton'
Does anyone know where the path for the package is stored so I could manually change it?