Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1148 from xzyfer/feat/better-binding-error
Browse files Browse the repository at this point in the history
Provide a useful error message when the binding is not found
  • Loading branch information
xzyfer committed Sep 16, 2015
2 parents 8889d12 + 01f9c18 commit 17cfde3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ sass.getBinaryPath = function(throwIfNotExists) {
}

if (!fs.existsSync(binaryPath) && throwIfNotExists) {
throw new Error(['`libsass` bindings not found in ', binaryPath, '. Try reinstalling `node-sass`?'].join(''));
throw new Error([
['The `libsass` binding was not found in', binaryPath].join(' '),
['This usually happens because your node version has changed.'],
['Run `npm rebuild node-sass` to build the binding for your current node version.'],
].join('\n'));
}

return binaryPath;
Expand Down
2 changes: 1 addition & 1 deletion test/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('library detection', function() {
assert.throws(function() {
fs.renameSync(originalBin, renamedBin);
process.sass.getBinaryPath(true);
}, /`libsass` bindings not found/);
}, /The `libsass` binding was not found/);

fs.renameSync(renamedBin, originalBin);
});
Expand Down

0 comments on commit 17cfde3

Please sign in to comment.