NPM, Gulp, and The Case of The Naughty Global Package
Tags: node, gulp, npm, matthewcalecom
Published: 2020-07-25 00:37:30

---
title: NPM, Gulp, and The Case of The Naughty Global Package
published: true
description: Global installations of things and SYMLINKs can be no fun when fat fingers are involved.
tags: node, gulp, npm, matthewcalecom
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/v65vtypvf148y6sppjqn.png
---

__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?

```shell
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.
```

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

```shell
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
```

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](https://stackoverflow.com/questions/36634657/how-do-i-fix-this-npm-install-conflict-between-existing-files-symlinks) 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 

```shell
which gulp # --> /usr/local/bin/gulp
```

__Cavern One__
```shell
mbp-mcale:~ matt.cale$ ls -l /usr/local/bin/gulp
/usr/local/bin/gulp -> ../lib/node_modules/glup-cli/bin/gulp.js
```

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. 💚