If you're not using a task runner like grunt or gulp to automate your front-end development workflow then you're missing out on some incredibly powerful tools that can help simplify and improve your productivity.
That said this is the world of software development and not everything always runs as smoothly as we might like.
After updating a pre-existing gulp installation we came across the following errors when trying to execute the task runner (that had been working perfectly beforehand).
Error: cannot find module 'gulp-util'
Okay, this was pretty annoying and took a couple of hours to resolve but everytime we tried to run gulp from the command line we would receive the same error message:
Error: Cannot find module 'gulp-util' at Function.Module._resolveFilename (module.js:338:15)
After some quick googling (and that old stalwart Stack Overflow....really, where would we developers be without those two?!) we figured out (and it was probably obvious that this was the first step we should have took) that we needed to use the Node Package Manager to install the gulp-util module like so:
npm install gulp-util --save-dev
Once that module had been installed we tried running the task runner only to hit another error message informing us that the following module wasn't installed:
Error: Cannot find module 'lodash._objecttypes' at Function.Module._resolveFilename (module.js:338:15)
We won't bore you with each and every error we encountered but we will list the packages we had to install in order to overcome these and ultimately get gulp to execute our front-end tasks without stopping and spitting error messages to the console:
sudo npm install -g lodash sudo npm install -g lodash-cli npm install lodash._objecttypes --save-dev sudo npm install lodash._shimkeys --save-dev sudo npm install lodash._setbinddata --save-dev sudo npm install lodash._isnative --save-dev sudo npm install lru-cache --save-dev sudo npm install sigmund --save-dev sudo npm install lodash.isobject --save-dev sudo npm install inherits --save-dev sudo npm install gulp-ignore --save-dev sudo npm install uuid --save-dev sudo npm install decompress --save-dev sudo npm install each-async --save-dev sudo npm install through2 --save-dev sudo npm install request --save-dev
There's probably something we overlooked or didn't realise/weren't aware of that could have bypassed all of the above and got gulp up and running a lot quicker - if you have any recommendations on that front please feel free to drop a comment below and give us a heads up.
As you can see though it took quite a few hoops to jump through before we could get the task runner working again.
If any of you out there are experiencing a similar issue with gulp complaining about modules not being able to be found we hope the above helps you to resolve those.