Sanford Staab
Sanford Staab

Reputation: 289

Gulp can't find itself locally

gulpfile.js:

var gulp = require('gulp');                       
var console = require('console');                 

gulp.task('default', function() {                 
  console.log('The "Gulp Default Task" is done.');
}); 

nodejs commands:

λ gulp
[17:17:48] Local gulp not found in ~\nodework\dyncss
[17:17:48] Try running: npm install gulp

$ (master) ([email protected])
λ npm install gulp --save-dev
C:\Users\TheStaabFamily\AppData\Roaming\npm\gulp -> C:\Users\TheStaabFamily\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
C:\Users\TheStaabFamily\AppData\Roaming\npm
└── [email protected]

$ (master) ([email protected])
λ gulp
[20:23:58] Local gulp not found in ~\nodework\dyncss
[20:23:59] Try running: npm install gulp

WTF? This is on Win7 x64. It took me quite awhile to install VStudio so node-gyp (a dependency of gulp) could build itself during the gulp install. I initially installed gulp with:

npm install -g gulp

Incidentally, my package.json is also not being updated by npm when I try to install gulp with the -D or --save-dev options. I am a new node user so please excuse if this question is too noobie. THANKS!!!

Upvotes: 0

Views: 1261

Answers (2)

Sanford Staab
Sanford Staab

Reputation: 289

See http://www.bartread.com/2014/02/17/whats-difference-locally-globally-installing-npm-packages/ for details.

Gulp should be installed globally and then linked into projects that use it:

npm install -g gulp

npm link --local gulp (run from your project root directory)

or...

Installed locally and linked globally:

npm install gulp
npm link --global gulp

Upvotes: 1

Shrinath
Shrinath

Reputation: 362

While installing gulp don't forget to put '-g' in command. it will install globally.

i hope because of user rights and all, sometimes during installation gulp install path was not added in environment PATH variable. you must have to add manually your installed directory path in PATH variable. so that 'gulp' keyword will be available locally globally.

Upvotes: 0

Related Questions