search

Home  >  Q&A  >  body text

node.js - 怎么删除node_modules文件夹?

在windows下安装了一个包,但是在删除node_modules文件夹时提示该文件夹包含名称过长删除不了。怎么才能彻底删除这个文件夹?

天蓬老师天蓬老师2782 days ago617

reply all(7)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:33:48

    Recommend giving it a try

    npm install rimraf -g
    rimraf node_modules

    reply
    0
  • 黄舟

    黄舟2017-04-17 13:33:48

    When I get the prompt that it is too long under Win8, I can delete it directly but cannot delete it to the trash.

    In addition, you can use rmdir /s/q your_app_dir in the command console to delete

    Another way is to enter the node_modules directory and delete the directories one by one until the one that cannot be deleted is reached. Go in again and repeat. In fact, basically go into the node_modules directory, go a few more levels and try again. Delete the ones inside and then delete the ones outside.

    reply
    0
  • 黄舟

    黄舟2017-04-17 13:33:48

    Look at the error message and see which module file name is too long. Use the command npm uninstall 模块名 to uninstall the module through the command, and then try to delete the directory again. If it still doesn’t work, repeat the uninstall command until it is Until all modules with too long names are uninstalled

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 13:33:48

    rm -f /node_modules

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 13:33:48

    Right-click to obtain administrator rights first, and then delete. Or shred folders through Computer Manager or 360

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 13:33:48

    Use 7zip or rar to add to the compressed file, and select to delete the original file, and then delete the compressed file.

    @leftstick’s npm uninstall works too.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 13:33:48

    Use rimraf directly under windows.

    reply
    0
  • Cancelreply