DEV Community

Cover image for NPM, Gulp, and The Case of The Naughty Global Package
Matthew Cale
Matthew Cale

Posted on

NPM, Gulp, and The Case of The Naughty Global Package

Meta TL;DR

Using --force would have worked for me 🤷‍♀️

TL;DR

There is an NPM package named glup-cli and when you are trying to download gulp-cli things can get a bit confusing since the makers of glup-cli also export a bin command called gulp and create a SYMLINK to the spot that the real gulp-cli needs to go. This surfaces in the real gulp-cli being un-installable because something already possesses the SYMLINK for /usr/local/bin/gulp

Recently, I have been making a little webpage for myself (matthewcale.com), and it's coming along just fine I'd say. I am using Pug (Markup) and Stylus (Styles) and Surge (Hosting) along with some neat CSS animations written by very smart folks from around the net. There are incredible folks who have made me feel like I am coding in the year 4000.

At the moment everything I am doing is accomplished with NPM scripts, and everything gets done. It is, however, a tiny bit tedious and I'd like to employ a task runner to get things to really sparkle.

There are a boatload of task runners and bundlers out there. I personally like the amount of control I have using a tool like Gulp and while I haven't used it in a while I still recall it fondly.

I visited their homepage and found out that since I stopped using it for my normal dev life they have changed it a good bit, and now it is suggested that a user have a local task runner and a global CLI tool installed. Not to worry, npm i -g gulp-cli to the rescue. Doh! What happened?

mbp-mcale:~ matt.cale$ npm i -g gulp-cli
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/gulp-cli/bin/gulp.js
npm ERR! dest /usr/local/bin/gulp
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/gulp-cli/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR! File exists: /usr/local/bin/gulp
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
Enter fullscreen mode Exit fullscreen mode

🤔 -- Well, what is this now? Something else already exists there? Well, that's fine I will just remove it!

mbp-mcale:~ matt.cale$ npm uninstall -g gulp
up to date in 0.021s
mbp-mcale:~ matt.cale$ npm uninstall -g gulp-cli
up to date in 0.021s
Enter fullscreen mode Exit fullscreen mode

Let's try again! Doh! Same error? What the heck?

cracks knuckles and neck

Let's figure this out! to the Googles/Stackoverflows!

Googles: "EEXIST: file already exists, symlink"

A bit of a bust to be honest, one well intentioned gentlemen here was having a different problem and his solution was just deleting the items from the package.json and being careful about node versions and environments.

The mystery thickens!

At this point I could try fancier googles, but I am pretty keen on finding the solution myself. So I dawn my spelunking gear and head to

which gulp # --> /usr/local/bin/gulp
Enter fullscreen mode Exit fullscreen mode

Cavern One

mbp-mcale:~ matt.cale$ ls -l /usr/local/bin/gulp
/usr/local/bin/gulp -> ../lib/node_modules/glup-cli/bin/gulp.js
Enter fullscreen mode Exit fullscreen mode

Wait a tick! What the heck is glup-cli?

As it turns out glup-cli is, in my opinion, a poorly named (verging on suspicious) package that will take the place of the global gulp command and instead of running gulp task will, AFAICT, (I didn't run the thing) attempt to scaffold out a basic Express project.

The project, to me, seems to be a misnomer, but there you have it! Uninstall glup-cli and install and gulp-cli and head out being a little less frustrated. 💚

Top comments (0)