3

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?

polarcare
  • 575
  • 1
  • 6
  • 24

1 Answers1

5

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.

mscdex
  • 104,356
  • 15
  • 192
  • 153
  • Thanks. I created an empty "node_modules" folder and then ran "npm install gulp-sass --save-dev" and it installed it in the empty "node_modules" directory. I did a gulp tutorial a few months back when testing it out and I didn't need to manually create the node_modules folder, anyway thanks again! – polarcare Aug 22 '15 at 16:31
  • This question has good answer in following link.[link](http://stackoverflow.com/questions/21250849/npm-install-doesnt-create-node-modules-directory) – Sharifullah Sharif Aug 18 '16 at 14:02