简体   繁体   中英

cannot find module '@babel/generator' but it installed

i have " cannot find module '@babel/generator' " error while trying generate signed apk. But i installed this package using yarn add, this is part of my package.json:

 "dependencies": {
    "@babel/cli": "^7.17.6",
    "@babel/generator": "^7.17.9",
    "@babel/plugin-transform-async-to-generator": "^7.16.8",

and my package lock json:

  "dependencies": {
    "@ampproject/remapping": "^2.1.0",
    "@babel/code-frame": "^7.16.7",
    "@babel/generator": "^7.17.9",

and many match when i use ctrl+f in package.lock.json and search babel/generator

I received the same error when i was trying to install the dependencies of my project.

Solution:

  • Delete the node_modules folder of the project
  • Remove the yarn.lock or package.lock file from your project
  • Install the dependencies again, by using yarn or npm install command.

The above steps fixed my error with the @babel/generator.

Simply delete the node_modules folder and re-install all the packages by running npm install or yarn install .

If the error persists, simply install the @babel/generator package to your project or globally.

Check out the package and installation guide here

in my case it solved by this command $ yarn install --check-files

and then restart the dev server Verifies that already installed files in node_modules did not get removed Good luck

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM