Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm not creating node_modules folder in project directory

Tags:

node.js

npm

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?

like image 866
polarcare Avatar asked Jun 01 '26 12:06

polarcare


1 Answers

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.

like image 161
mscdex Avatar answered Jun 03 '26 08:06

mscdex