結論 node-sassはupdateしてからrebuild
エラー内の、「node-sassをrebuildしようね」というメッセージに促されるまま
rebuildを試して解消されないエラー首を捻っていましたが
その前に、updateいるよね!確かに!
$ npm update node-sass@latest $ npm rebuild node-sass
当たり前っちゃあ当たり前のことで、ちょっと情けない気もしますが、大事なことなので記録にのこしときます。
Missing bindingから二転三転した様子
以下、エラー発生からさまよった様子です。
久しぶりに立ち上げた環境で、Nodeのバージョンを上げて 起動コマンド npm start
を実行してみるとエラー
Error: Missing binding /Users/webdev/_work/template/node_modules/node-sass/vendor/darwin-x64-72/binding.node Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x Found bindings for the following environments: OS X 64-bit with Node.js 10.x
npm
のキャッシュをクリアしても、node_modules
を削除してnpm install
からやり直しても解消できずnode-sass
をリビルドしたら解決した記事にならってnom rebuild node-sass
を実行したら、gulp-sass
無いよらしきエラー。
$ npm start template@0.1.0 start /Users/webdev/_work/template gulp internal/modules/cjs/loader.js:613 throw err; ^ Error: Cannot find module 'gulp-sass'
調べてみると、このエラーはNodeを9以下にダウングレードしたら解消するらしく
参考にならってみると、npm install
も成功しgulp
コマンドも実行できるようになりました。
参考:
npm iでエラー「node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.1.3 and node@10.0.0」
けど、他のパソコンの開発環境だとNodeがstableでもこのエラーは出てないんだが…
今ならいけるかもと、node
をstable
へ戻してgulpを実行してみたところ
見事に振り出しへもどりました。
$ nodebrew use stable use v12.13.1 $ npm start template@0.1.0 start /Users/webdev/_work/template gulp /Users/webdev/_work/template/node_modules/node-sass/lib/binding.js:15 throw new Error(errors.missingBinary()); ^ Error: Missing binding /Users/webdev/_work/template/node_modules/node-sass/vendor/darwin-x64-72/binding.node Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x Found bindings for the following environments: OS X 64-bit with Node.js 10.x This usually happens because your environment has changed since runningnpm install
. Runnpm rebuild node-sass
to download the binding for your current environment.
改めてgulp-sass node 10
で検索してみたところ
同じ悩みを公式に吐露している人がいるではありませんか。
しっかり回答もあるし。
うん、updateをするよう促されてる。ですよね。
アップデート何で気づかなかったんだ。
参考:
node.js version 10 error · Issue #693 · dlmanning/gulp-sass
npm update node-sass@latest
、エラーにならず実行できたけど
gulpはまだエラーで実行できない。

いまかー!
$ npm update node-sass@latest $ npm rebuild node-sass