Over the last few weeks, I have become a massive fan of Grunt. Amongst other things, it makes development with Sass and CoffeeScript much easier by running their compile-processes automatically and reloading the browser via LiveReload. It basically gives you frontend-superpowers.
Grunt has given such a big boost to my productivity that suddenly losing part of it felt like the worst thing that could happen. Even more so considering that a client deadline was rapidly approaching at the time.
Seemingly out of nowhere, grunt-contrib-sass failed with the following error message:
The source of the problem was surprisingly difficult to pin down, primarily because the error message is rather cryptic. Some assertion failed, that is nice. It even tells me the file and exact line this error occured on, which I tracked down to a file in the Node.js-repository:
Unfortunately, this does not help at all.
It took a few good hours to figure out what had happened. Turns out that the innocent-looking
I had run earlier to update all packages installed through Homebrew also updated my installation of Node.js from version 0.10.6 to 0.10.8. However, that new version of Node.js does not currently work with grunt-contrib-sass.
To get it working again, we need to temporarily downgrade Node.js to an earlier version. Homebrew allows us to install different versions of the same package and switch between them.
First, you need to change to
/usr/local/, which is where Homebrew lives by default:
There you can request a list of all versions of
node that are available via Homebrew:
Homebrew even provides the
git-command you need to run to install the version. Run these commands to install 0.10.7:
After the installation is done, version 0.10.7 is going to be active, while 0.10.8 is still installed.
With 0.10.7 active, grunt-contrib-sass once again purrs like a cat and does its thing.
If you want to switch between installed versions later, you can do so by running
brew switch <formula> <version>: