How to Delete node_modules - Deep Nested Folder in Windows

前端 未结 30 1063
逝去的感伤
逝去的感伤 2020-12-02 03:25

Upon trying to remove the node_modules directory created by npm install:

The source file name(s) are larger than is su

30条回答
  •  孤城傲影
    2020-12-02 04:10

    One solution that I use:

    (I would prefer to avoid installing a new extension (rimraf) when working with CI environments.)

    1. A) Rename packages.json to something else. B) Specially on CI - after npm install, I usually remove the file instead of renaming it, but if you need it, you don't have to do this. That's your choice.
    2. run npm init - this will create an empty packages.json file (no dependencies)
    3. run npm prune - this will match node_modules with the dependencies section of packages.json - which is now empty as the result of step #2.
    4. If you have chosen #1.A. step, delete the newly created packages.json, and rename original packages.json back to its original name.

提交回复
热议问题