Weird error after updating package.json of old project

Viewed 2220

Updated the packages.json of a old project to work on it and get this weird error. I don't even know what the issue is here. Any help is appreciated!

Compiled with problems:

ERROR in ./node_modules/@babel/runtime/helpers/esm/inherits.js 1:0-46

Module not found: Error: Can't resolve './setPrototypeOf' in 'C:\Users--\Desktop\Lowkey Meal - React\client\node_modules@babel\runtime\helpers\esm' Did you mean 'setPrototypeOf.js'? BREAKING CHANGE: The request './setPrototypeOf' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.

ERROR in ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js 1:0-46

Module not found: Error: Can't resolve './defineProperty' in 'C:\Users--\Desktop\Lowkey Meal - React\client\node_modules@babel\runtime\helpers\esm' Did you mean 'defineProperty.js'? BREAKING CHANGE: The request './defineProperty' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.

ERROR in ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js 1:0-74

Module not found: Error: Can't resolve './objectWithoutPropertiesLoose' in 'C:\Users--\Desktop\Lowkey Meal - React\client\node_modules@babel\runtime\helpers\esm' Did you mean 'objectWithoutPropertiesLoose.js'? BREAKING CHANGE: The request './objectWithoutPropertiesLoose' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.

2 Answers

Had similar problem when upgrading my package.json with create-react-app 5.0.0.

I'd already tried deleting node-modules and re-doing the npm install but it didn't work.

The trick was to delete node_modules AND package-lock.json before doing the npm install. After that the build worked fine.

Just type in terminal --> npm i --> press Enter Required module is not installed and after running this command all the required module will be installed automatically.

Related