Avatar ·

Where does npm install packages? And how to find the node_modules folder?

Hello everyone! I just started learning Node.js and npm, and I'm confused about where exactly npm installs packages. Here's the situation: I created a project, ran `npm init -y`, then installed express with `npm install express`. A `node_modules` folder appeared in the project folder. But when I globally installed the nodemon package with `npm install -g nodemon`, I didn't find it in my project. Where is it then? And why are some packages installed in the project, and some somewhere else? I also noticed that when I clone someone else's project from GitHub and run `npm install`, the packages are installed in the root folder of the project. But what if I have nested folders with package.json? For example, the structure: ``` my-project/ ├── package.json ├── server/ │ └── package.json └── client/ └── package.json ```