After I tried a refresh reinstall of node_modules in team’s project (I wanted to switch from v18.15.0 to v16.20.2 – NodeJS), when I type npm start, I got like 42 errors like:
Can’t import the named export (COMPONENT) from non EcmaScript module (only default export is available).
exemple
Any ideas to solve it? I have to mention that
my teammates can run the project without any error, so I don’t think my problem is related to some piece of code. Something’s wrong with some changes on my laptop.
Thanks!
It was weird that when I used npm install (to install the new version of NodeJS, I had to do it with —-force flag, because I got some warnings like:
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN react@"^17.0.2" from the root project
npm WARN 46 more (@material-ui/core, react-dom, @material-ui/icons, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from [email protected]
npm WARN node_modules/formik-material-ui
npm WARN formik-material-ui@"0.0.22" from the root project
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from [email protected]
npm WARN node_modules/formik-material-ui
npm WARN formik-material-ui@"0.0.22" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN react@"^17.0.2" from the root project
At the end of the logs file, I found:
Could not resolve dependency:
peer react@"^16.8.0" from [email protected]
node_modules/formik-material-ui
formik-material-ui@"0.0.22" from the root project
Conflicting peer dependency: [email protected]
node_modules/react
peer react@"^16.8.0" from [email protected]
node_modules/formik-material-ui
formik-material-ui@"0.0.22" from the root project
I get this error…
Theodor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
9
–legacy-peer-deps: ignore all peerDependencies when installing, in the style of npm version 4 through version 6.
–strict-peer-deps: fail and abort the install process for any conflicting peerDependencies when encountered. By default, npm will only crash for peerDependencies conflicts caused by the direct dependencies of the root project.
–force: will force npm to fetch remote resources even if a local copy exists on disk.
vidhi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.