From f0419a7adce8ab289a2583d36edb7bc30bd3a970 Mon Sep 17 00:00:00 2001 From: xzyfer Date: Mon, 6 Feb 2017 20:18:05 +1100 Subject: [PATCH] Fix npm rebuild Running `npm rebuild node-sass` as we instruct people, has been noop for a while. I'm not entirely sure what has changed. Debugging as reveal that running `rebuild` now just triggers the `install` and `postinstall` scripts. The `build` script is no longer run. This suggests something has changed in newer versions of npm. Since the `--force` flag is required to rebuild the binary I've update the `build` script to take into account if `--force` was passed to npm. --- lib/errors.js | 2 +- scripts/build.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/errors.js b/lib/errors.js index 1dbcf02a7..6bfb77f29 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -25,7 +25,7 @@ function foundBinariesList() { function missingBinaryFooter() { return [ 'This usually happens because your environment has changed since running `npm install`.', - 'Run `npm rebuild node-sass` to build the binding for your current environment.', + 'Run `npm rebuild node-sass --force` to build the binding for your current environment.', ].join('\n'); } diff --git a/scripts/build.js b/scripts/build.js index ef919eed5..7bbba5ee4 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -93,7 +93,8 @@ function build(options) { function parseArgs(args) { var options = { arch: process.arch, - platform: process.platform + platform: process.platform, + force: process.env.npm_config_force === 'true', }; options.args = args.filter(function(arg) {