问题
I've got this git repo : https://github.com/mschwarzmueller/angular-2-introduction .
Watching a series of tutorials and I got to the point where I must run gulp, but it gives me an error.
From the beginning I cloned this repo, then I did npm install
being in that folder.
I inspected the package.json
and indeed there are gulp dependencies.
So what should I do?
If I install gulp globally will it behave normally?
Or I must somehow install it locally?
P.S. : I tried this and encountered the error on Windows and Linux machine.
回答1:
If you want to run gulp locally you could try this after having installed dependencies with an npm install
:
$(npm bin)/gulp
回答2:
When you issue npm install module
npm will install in current directory.
When you issue npm install -g module
npm will install in the /usr/local/lib/node or /usr/local/lib/node_modules folders
It is recommended when using modules on command line interface installing them globally.
If you want to use it as a command line tool, something like the grunt CLI, then you want to install it globally. On the other hand, if you want to depend on the package from your own module using something like Node's require, then you want to install locally.
https://docs.npmjs.com/getting-started/installing-npm-packages-globally
That said if you wish to issue gulp commands on command line its possible instead of installing the 'gulp' module you may want the 'gulp-cli' module: https://www.npmjs.com/package/gulp-cli
来源:https://stackoverflow.com/questions/36457377/nodejs-gulp-not-found-after-npm-install