I try to install express package using npm from inside /home/iwan/my-project directory:
npm install express
express@3.3.7 ../node_modules/express
├── method
If the node_modules
directory doesn't exist in your current directory, NPM will look for it in the higher directories until it finds it. So, if the parent directory has a node_modules
directory, NPM will assume that's where it is to install modules.
A quick way around this is to create an empty node_modules
directory where you want the modules to be placed.