How to clean node_modules folder of packages that are not in package.json?

后端 未结 13 1297
别那么骄傲
别那么骄傲 2020-12-02 03:58

Assume I install project packages with npm install that looks into package.json for modules to be installed. After a while I see that I don\'t need

13条回答
  •  鱼传尺愫
    2020-12-02 04:26

    I have added few lines inside package.json:

    "scripts": {
      ...
      "clean": "rmdir /s /q node_modules",
      "reinstall": "npm run clean && npm install",
      "rebuild": "npm run clean && npm install && rmdir /s /q dist && npm run build --prod",
      ...
    }
    

    If you want to clean only you can use this rimraf node_modules or rm -rf node_modules.

    It works fine

提交回复
热议问题