polarcare
polarcare

Reputation: 575

npm not creating node_modules folder in project directory

I am doing a small Sinatra project and I want to use Gulp.

I have node(v0.12.0), npm(2.13.1), gulp(3.9.0) installed. I am in my project directory but when I try install a package like "npm install gulp-sass --save-dev", it doesn't create any "node_modules" folder in my project directory. It seems to be installing the package in my user home directory. Anything I am doing wrong?

Upvotes: 3

Views: 11923

Answers (1)

mscdex
mscdex

Reputation: 106696

From the npm documentation:

Starting at the $PWD, npm will walk up the folder tree checking for a folder that contains either a package.json file, or a node_modules folder. If such a thing is found, then that is treated as the effective "current directory" for the purpose of running npm commands. (This behavior is inspired by and similar to git's .git-folder seeking logic when running git commands in a working dir.)

If no package root is found, then the current folder is used.

Upvotes: 5

Related Questions