"Error: The libsass binding was not found" when running gulp

I was recently futzing around with a Drupal site that has a fairly complex theme setup, and which relies on npm/gulp to setup and build the theme assets. One time after not touching the project for a couple weeks, when I came back and ran the gulp command again, I got the following error:

<br />
/path/to/node_modules/node-sass/lib/extensions.js:158<br />
    throw new Error([<br />
          ^<br />
Error: The `libsass` binding was not found in /path/to/node_modules/node-sass/vendor/darwin-x64-14/binding.node<br />
This usually happens because your node version has changed.<br />
Run `npm rebuild node-sass` to build the binding for your current node version.<br />
    at Object.sass.getBinaryPath (/path/to/node_modules/node-sass/lib/extensions.js:158:11)<br />
    at Object.<anonymous> (/path/to/node_modules/node-sass/lib/index.js:16:36)<br />
    at Module._compile (module.js:460:26)<br />
    at Object.Module._extensions..js (module.js:478:10)<br />
    at Module.load (module.js:355:32)<br />
    at Function.Module._load (module.js:310:12)<br />
    at Module.require (module.js:365:17)<br />
    at require (module.js:384:17)<br />
    at Object.<anonymous> (/path/to/node_modules/gulp-sass/index.js:176:21)<br />
    at Module._compile (module.js:460:26)<br />
</anonymous></anonymous>

And I think that the line This usually happens because your node version has changed. was exactly right. I manage npm and my Node.js install using Homebrew, and I remember having updated recently; it went from 4.x to 5.x. I also remembered that the project itself was supposed to be managed with 0.12!

So first things first, I installed nvm and used it to switch back to Node.js 0.12:

<br />
brew install nvm<br />
source $(brew --prefix nvm)/nvm.sh<br />
nvm install 0.12<br />

Then, I re-ran npm install inside the theme directory to make sure I had all the proper versions/dependencies. But I was still getting the error. So I found this answer on Stack Overflow, which suggested rebuilding node-sass with:

<br />
npm rebuild node-sass<br />

After that ran a couple minutes, gulp worked again, and I could move along with development on this particular Drupal site. Always mind your versions for Node.js!