24

I have installed node js latest version(8.8.1) and npm latest version(5.5.1) and when i try to install node-sass i get this:

npm install -g node-sass

C:\Users\Giannis\AppData\Roaming\npm\node-sass -> C:\Users\Giannis\AppData\Roaming\npm\node_modules\node-sass\bin\node-sass

node-sass@4.5.3 install C:\Users\Giannis\AppData\Roaming\npm\node_modules\node-sass node scripts/install.js

'node' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.5.3 install: node scripts/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@4.5.3 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Giannis\AppData\Roaming\npm-cache_logs\2017-10-26T11_57_10_751Z-debug.log

I have set the system variable C:\Program Files\nodejs\

Thanks

Giannis Savvidis
  • 692
  • 4
  • 13
  • 34

2 Answers2

63

node-sass requires node-gyp https://github.com/sass/node-sass#install

node-gyp requires windows-build-tools https://github.com/nodejs/node-gyp#on-windows

Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

Gabriel Bleu
  • 9,703
  • 2
  • 30
  • 43
  • 2
    I found it. I had to remove cygwin from enviroment variables. Thanks – Giannis Savvidis Oct 27 '17 at 15:27
  • Thank you for your valuable answer, I found this helpful. @GabrielBleu – Iswar Jun 26 '18 at 06:56
  • Is there any way to use node-sass without the build tools on windows? I don't have administrator access to my machine so can't get windows-build-tools installed. – Ryan Oct 12 '19 at 01:09
  • 7
    `windows-build-tools` doesn't work any more apparently. installation is stuck and many others complain the same on the github issues page :/ – vsync Dec 12 '20 at 22:24
  • 1
    Any updates on this? ```windows-build-tools``` doesn't work anymore. Thought I found the answer but then stuck again. – Gokul Krishna Feb 01 '21 at 16:35
1

Using the npm install --global --production windows-build-tools on an Elevated prompt works for me. The installer got stuck on visual studio build tools, but they were already installed on my system. So i ctrl +c the npm install process and run it once again. This time a messages shows up that the build tools are already installed and the installation will be skipped and continued with python configuration.

Finally the node-sass installation completed successfully.

BTW node-sass usage is deprecated and will be removed. The suggestion is to start using sass.

Michael
  • 46
  • 5