社内プロキシのせいでnode-sassのinstallに失敗する
社内プロキシの関係で npm install がブロックされるときはCntlmをインストールして諸々設定した後、次のコマンドをコマンドプロンプトで流し込むと大抵は動作する。
set http_proxy=localhost:3128
set https_proxy=localhost:3128
npm config set strict-ssl false
npm config set proxy http://localhost:3128
npm config set https-proxy http://localhost:3128
npm config set registry http://registry.npmjs.org/
npm -g config set proxy http://localhost:3128
npm -g config set https-proxy http://localhost:3128
npm -g config set registry http://registry.npmjs.org/
だがnode-sassは駄目。バイナリのダウンロードでコケる。fuxx。
そういうときはリリースページからダウンロードに失敗しているバイナリを直接落として任意のフォルダに配置して次のコマンドを実行する。自分の場合はwin32-x64-72_binding.nodeをダウンロードして、C:\work\safe_node_modulesに配置した。
set SASS_BINARY_PATH=C:\work\safe_node_modules\win32-x64-72_binding.node
npm config set SASS_BINARY_PATH=C:\work\safe_node_modules\win32-x64-72_binding.node
もう npm install でコケたりしない。
参考
Cannot download "https://github.com/sass/node-sass/releases/download/v4.13.0/win32-x64-79_binding.node" · Issue #2773 · sass/node-sass https://github.com/sass/node-sass/issues/2773