20

I'm constantly working on new web development projects that don't ever, in practice, need their node_modules folder when deploying. It would suit me much more if I was just able to create a small gulpfile.js for each project, rather than 6000+ files contained in the node_modules folder for every project, that are only ever used by me on this machine.

I only use Gulp to compile SASS and prefix and minify my CSS. I don't need to worry about any other type of deployment issues, but the documentation says I need both: Global and local copies of Gulp.

Chuck Le Butt
  • 47,570
  • 62
  • 203
  • 289

1 Answers1

43

Gulp needs to be installed locally, but you can link the local install to a global install:

npm install --global gulp
npm link gulp

See also https://stackoverflow.com/a/30742196/451480

Community
  • 1
  • 1
Blaise
  • 13,139
  • 9
  • 69
  • 97
  • 2
    Why would I want to link the local install to the global? – Chuck Le Butt Oct 06 '15 at 16:11
  • 8
    Linking prevents having 6000+ files in each project because you *link* to the global install, you don't *duplicate* the global install. You only have to do this for Gulp (see link for reason). Other NPM packages can be installed globally the normal way. – Blaise Oct 07 '15 at 08:57
  • because working with docker, having `gulp` and gulp modules within the container to have everything compile safely (osx/win), linking it to a 'volume' works nice with osx, but not with windows. Also requires (creates) a node_modules if non otherwise is needed. – BananaAcid Feb 18 '19 at 11:40