Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node sass install fails to compile (Windows 7) #1379

Closed
gallagherrchris opened this issue Feb 11, 2016 · 14 comments
Closed

Node sass install fails to compile (Windows 7) #1379

gallagherrchris opened this issue Feb 11, 2016 · 14 comments

Comments

@gallagherrchris
Copy link

I have attached the debug information below. I have installed the Express edition of Visual Studio 2013. It appears to be an issue with my C++ compilation, but I am unsure what exactly is wrong.

Things I have tried

  • --msvs_version=2013
  • Upgraded node (4.x.x, and 5.x.x).
C:\Temp>npm -v
2.7.4
C:\Temp>node -v
v0.12.2
C:\Temp>node -p process.versions
{ http_parser: '2.3',
  node: '0.12.2',
  v8: '3.28.73',
  uv: '1.4.2-node1',
  zlib: '1.2.8',
  modules: '14',
  openssl: '1.0.1m' }
C:\Temp>node -p process.platform
win32
C:\Temp>node -p process.arch
x64
C:\Temp>where python
C:\Python27\python.exe
C:\Temp>python --version
Python 2.7.9
C:\Temp>npm cache clean
C:\Temp>npm install -ddd node-sass > npm.log 2> npm.err

npm.err.txt
npm.log.txt

@xzyfer
Copy link
Contributor

xzyfer commented Feb 11, 2016

Relevant section of the error log

npm info install node-gyp@3.2.1
npm info postinstall node-gyp@3.2.1
npm verb unlock done using C:\Users\gallaghc\AppData\Roaming\npm-cache\_locks\node-gyp-b9af356766111992.lock for C:\Temp\node_modules\node-sass\node_modules\node-gyp
npm verb about to build C:\Temp\node_modules\node-sass
npm info build C:\Temp\node_modules\node-sass
npm verb linkStuff [ false, false, false, 'C:\\Temp\\node_modules' ]
npm info linkStuff node-sass@3.4.2
npm verb linkBins node-sass@3.4.2
npm verb link bins [ { 'node-sass': 'bin/node-sass' },
npm verb link bins   'C:\\Temp\\node_modules\\.bin',
npm verb link bins   false ]
npm verb linkMans node-sass@3.4.2
npm verb rebuildBundles node-sass@3.4.2
npm verb rebuildBundles [ '.bin',
npm verb rebuildBundles   'async-foreach',
npm verb rebuildBundles   'chalk',
npm verb rebuildBundles   'cross-spawn',
npm verb rebuildBundles   'gaze',
npm verb rebuildBundles   'get-stdin',
npm verb rebuildBundles   'glob',
npm verb rebuildBundles   'meow',
npm verb rebuildBundles   'mkdirp',
npm verb rebuildBundles   'nan',
npm verb rebuildBundles   'node-gyp',
npm verb rebuildBundles   'npmconf',
npm verb rebuildBundles   'request',
npm verb rebuildBundles   'sass-graph' ]
npm info install node-sass@3.4.2
npm verb unsafe-perm in lifecycle true
npm info postinstall node-sass@3.4.2
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Temp\\node_modules\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.2.1
gyp info using node@0.12.2 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at F (C:\Temp\node_modules\node-sass\node_modules\node-gyp\node_modules\which\which.js:63:19)
gyp verb `which` failed     at E (C:\Temp\node_modules\node-sass\node_modules\node-gyp\node_modules\which\which.js:72:29)
gyp verb `which` failed     at C:\Temp\node_modules\node-sass\node_modules\node-gyp\node_modules\which\which.js:81:16
gyp verb `which` failed     at C:\Temp\node_modules\node-sass\node_modules\node-gyp\node_modules\which\node_modules\isexe\index.js:44:5
gyp verb `which` failed     at C:\Temp\node_modules\node-sass\node_modules\node-gyp\node_modules\which\node_modules\isexe\windows.js:29:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:95:15)
gyp verb `which` failed  python2 [Error: not found: python2]
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Python27\python.EXE
gyp verb check python version `C:\Python27\python.EXE -c "import platform; print(platform.python_version());"` returned: "2.7.9\r\n"
gyp verb get node dir no --target version specified, falling back to host node version: 0.12.2
gyp verb command install [ '0.12.2' ]
gyp verb install input version string "0.12.2"
gyp verb install installing version: 0.12.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 0.12.2
gyp verb build dir attempting to create "build" dir: C:\Temp\node_modules\node-sass\build
gyp verb build dir "build" dir needed to be created? C:\Temp\node_modules\node-sass\build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: C:\Temp\node_modules\node-sass\build\config.gypi
gyp verb config.gypi checking for gypi file: C:\Temp\node_modules\node-sass\config.gypi
gyp verb common.gypi checking for gypi file: C:\Temp\node_modules\node-sass\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Temp\\node_modules\\node-sass\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Temp\\node_modules\\node-sass\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Temp\\node_modules\\node-sass\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\gallaghc\\.node-gyp\\0.12.2\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\gallaghc\\.node-gyp\\0.12.2',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Temp\\node_modules\\node-sass\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Temp\\node_modules\\node-sass',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Temp\\node_modules\\node-sass\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\gallaghc\.node-gyp\0.12.2
gyp verb found first Solution file build/binding.sln
gyp verb could not find "msbuild.exe" in PATH - finding location in registry 
gyp verb "Release" dir needed to be created? null
gyp verb copying "node.lib" for x64 C:\Users\gallaghc\.node-gyp\0.12.2\Release\node.lib
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Temp\node_modules\node-sass\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Temp\\node_modules\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Temp\node_modules\node-sass
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok 
Build failed
npm verb unsafe-perm in lifecycle true
npm info node-sass@3.4.2 Failed to exec postinstall script
npm verb unlock done using C:\Users\gallaghc\AppData\Roaming\npm-cache\_locks\node-sass-dc776b393baee306.lock for C:\Temp\node_modules\node-sass
npm verb stack Error: node-sass@3.4.2 postinstall: `node scripts/build.js`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
npm verb stack     at EventEmitter.emit (events.js:110:17)
npm verb stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:14:12)
npm verb stack     at ChildProcess.emit (events.js:110:17)
npm verb stack     at maybeClose (child_process.js:1015:16)
npm verb stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
npm verb pkgid node-sass@3.4.2
npm verb cwd C:\Temp
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-ddd" "node-sass"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! code ELIFECYCLE

npm ERR! node-sass@3.4.2 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@3.4.2 postinstall script 'node scripts/build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]

@saper
Copy link
Member

saper commented Feb 12, 2016

That's the TRACKER TRK002 error when running CL.EXE

@pcimino
Copy link

pcimino commented Feb 12, 2016

I'm having a different issue with Windows 7 and VS 2013. Appears that when npm pulls down the files to build a lot of header files are missing.

Here's a gist with all the error logs
https://gist.github.com/pcimino/521fb2fde65591ba8ad0

No idea why it keeps telling me to set the HTTP_PROXY environment, I've set it in the bash and in the npm config.

fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory (..\src\sass_context_wrapper.cpp) [c:...\node_modules\node-sass\build\binding.vcxproj]

@saper
Copy link
Member

saper commented Feb 12, 2016

@pcimino which Windows SDK do you have installed?

@pcimino
Copy link

pcimino commented Feb 12, 2016

At the time of this attempt only VS 2013. The frustrating thing is node-sass/gulp-sass would install and worked for over a year. Recently I installed VS 2015 and now node-sass won't compile. Went through all the trouble shooting docs, states all I need is 2015, so uninstalled all MS C++ and visual studio libraries and started over with SDK 7 and C++ 2010 along with the SP1 etc. Uninstalled that and tried 2013, uninstalled that and back to 2015. SImilar errors with all of them.

@saper
Copy link
Member

saper commented Feb 14, 2016

Please use only VS2013 until the PlatformToolkit configuration will be sorted out.

@saper
Copy link
Member

saper commented Feb 14, 2016

Your first problem is this:

Cannot download "https://github.com/sass/node-sass/releases/download/v3.4.2/win32-x64-46_binding.node"
: 

tunneling socket could not be established, cause=write EPROTO

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g. 

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

That suggests some problems with the networking (or more likely proxy) setup. I'd check npm bug reports like npm/npm#10261 for a possible solution.

@saper
Copy link
Member

saper commented Feb 14, 2016

The attempt to compile fails because the Windows SDK cannot be found:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(362,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [c:\upf\opensourceupf-workspace\serenity.nsb.client2\node_modules\node-sass\build\binding.vcxproj]

Check your registry entries to make sure your SDKs are properly installed:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A

etc.

Those directories should contain InstallationFolder for every SDK installed, make sure the entry is there and the SDK directory actually exists.

@saper
Copy link
Member

saper commented Feb 14, 2016

Also make sure you are running your npm installation out of the Visual Studio 2013 command shell, so that all environment variables including paths to the SDK are set.

@gallagherrchris
Copy link
Author

I fixed my problem. My issue was due to the configuration of my work machine. My normal account did not have access to right path environment, so running as admin got me the right path and subsequently installed correctly.

I'll leave this open for pcimino

@pcimino
Copy link

pcimino commented Feb 16, 2016

I think I know when this all started... I installed the Github WIndows client and immediately started having git SSL issues. Thought I worked through all that...but in retrospect, the last time I ran a full successful npm install including sass, was before that.

Going to burn everything to the ground and start fresh with Win SDK 7, VS 2013, Node and a fresh install of git bash.

@pcimino
Copy link

pcimino commented Feb 16, 2016

That did it. Uninstalled everything, reboot, then reinstalled Node, Git, Win SDK 7 and VS 2013. Thanks for the ideas.

@xzyfer xzyfer closed this as completed Feb 16, 2016
@mazer-rakham
Copy link

I had this issue also, on two different apps, left the package.json in file structure, ran npm init, went through it quick, ran the npm rebuild on the modules it told me to, and then everything worked fine. Tried it exact same way in new folder and once again fixed it, dunno if this helps anyone.

@phptux
Copy link

phptux commented Jul 8, 2017

npm config set scripts-prepend-node-path true

Works for me with:

OS: Windows 10
Node: v5.1.0
node-sass: v4.5.3

jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this issue Apr 7, 2024
Fix checking whether we can use TAP mode...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants