# How remove everything inside Node\_modules with Yarn

**URL:** <https://forum.freecodecamp.org/t/how-remove-everything-inside-node-modules-with-yarn/177238>\
**Category:** General\
**Created:** [February 28, 2018, 10:03pm UTC](https://forum.freecodecamp.org/t/how-remove-everything-inside-node-modules-with-yarn/177238 "2018-02-28T22:03:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiholiu](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@chiholiu](https://forum.freecodecamp.org/u/chiholiu)\
**Post date:** [February 28, 2018, 10:03pm UTC](https://forum.freecodecamp.org/t/how-remove-everything-inside-node-modules-with-yarn/177238/1 "2018-02-28T22:03:36Z")

</div>

I have accidentally use Yarn install while I was in the wrong file, but how could I remove them with Yarn properly?

---

<div class="post-metadata">

**Author:** ![kevinSmith](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevinsmith/32/72934_2.png) [@kevinSmith](https://forum.freecodecamp.org/u/kevinSmith)\
**Post date:** [February 28, 2018, 10:28pm UTC](https://forum.freecodecamp.org/t/how-remove-everything-inside-node-modules-with-yarn/177238/2 "2018-02-28T22:28:08Z")

</div>

It’s hard to tell exactly what you mean, but if you have modules that you don’t want, you can always use `yarn remove`. As a failsafe, if things are too messed up, you can delete the directory `node_modules` and correct your `package.json` and then just do another `yarn install` to repopulate `node_modules` correctly.

---

<div class="post-metadata">

**Author:** ![chiholiu](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@chiholiu](https://forum.freecodecamp.org/u/chiholiu)\
**Post date:** [March 1, 2018, 6:50pm UTC](https://forum.freecodecamp.org/t/how-remove-everything-inside-node-modules-with-yarn/177238/3 "2018-03-01T18:50:56Z")

</div>

I removed the node\_modules via terminal, but i forgot to remove the package.json, therefore it kept installing in the previous old folder every time when I ran yarn install.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 11:33am UTC](https://forum.freecodecamp.org/t/how-remove-everything-inside-node-modules-with-yarn/177238/4 "2021-01-16T11:33:15Z")

</div>

Closed on January 16, 2021, 11:33am UTC


