I tried installing a package in my react app using npm, and for some reason It fails: it shows the following error:
npm ERR! Object for dependency "@babel/generator" is empty.
npm ERR! Something went wrong. Regenerate the package-lock.json with "npm install".
npm ERR! If using a shrinkwrap, regenerate with "npm shrinkwrap".
I tried npm install to regenerate the package-lock.json but it's the same as before.
There is some dependency error with npm, so how about clear project
First of all, How about clear node_modules
and package-lock.json
rm -rf ./node_modules package-lock.json
and retry install with
npm install
or npm i
and what I want to say is clear package-lock.json
and node_modules
. If you'd like to get more information about deleting here is the link
What version of the babel (and it's sub-modules) do you use? Show rows from your package.json file (related to babel). Your issue possibly could be resolved by updating all babel-related modules
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.