New to Gulp, somehow I installed different versions of Gulp globally and locally, triggering version mismatch warning messages. Is it possible for me to uninstall Gulp globally without affecting local installs?
By installing it globally the gulp script gets into your PATH because the global node/bin/ directory is most likely on your path. To respect your local dependencies though, gulp will use your locally installed version of itself to run the gulpfile.
To install the Gulp CLI globally, on your command line, run npm install gulp-cli -g . The -g flag means npm will install the package in the global npm directory, so you can run the gulp command from any directory.
First run npm -g install gulp-cli then run gulp -v. Alternatively, you can just run npm list gulp.
Yes you can.
You can uninstall using the -g flag, it will make sure only the global package is removed:
npm uninstall -g gulp
To remove a local package and remove it from the package.json dependencies property use:
npm uninstall package-name
To remove a local package and remove it from the package.json devDependencies property use:
npm uninstall -D package-name
Update: As you may have noticed, running "gulp" in your terminal now produces an error saying "No such file or directory"
You can just call the gulp executable directly. e.g:
./node_modules/.bin/gulp [arguments...]
Update: npm 5.2.0 and above comes with a new tool called 'npx'
Using the below command will look for the gulp binary for you:
npx gulp
Read more about npx in this Medium post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With