I tried to run a React script and it returned this error:
Module not found: Can't resolve '@material-ui/core' in 'C:\Users\julia\Documents\GitHub\Truffle test\client\src\Auth'
So I tried using npm to install material-ui/core as followed:
C:\Users\julia\Documents\GitHub\Truffle test\client>npm install material-ui/core
And was returned with a handful of errors:
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent An unknown git error occurred
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\julia\AppData\Local\npm-cache\_logs\2022-03-20T18_47_30_920Z-debug-0.log
Any ideas to what might be causing this and how I can fix this? I have tried deleting node_modules folder and reinstalling my packages using npm install
but the results remain the same.
CodePudding user response:
You will need to check your package.json
the package.json contains all the required node packages for a project
with the new material ui, v5 i think the installation scripts might be a bit different
https://www.npmjs.com/package/@mui/material
npm i @mui/material
for older versions
npm i @material-ui/core
https://mui.com/guides/migration-v4/
you can look at installation from the docs here
https://mui.com/getting-started/installation/
// with npm
npm install @mui/material @emotion/react @emotion/styled
// with yarn
yarn add @mui/material @emotion/react @emotion/styled
CodePudding user response:
Use the @ marker
npm i @material-ui/core