6

I've seen quite a few of these questions on SO, but none seem to solve or match the problem.
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x. The odd thing is, I don't have Node.js 6.x installed. From the command line, node -v gives me v5.10.1.

I'm the Angular4 Universal Asp.net core visual studio 2017 template straight out of the box.

I've tried

  • npm rebuild node-sass --force
  • Reordering node in Web External toolsin Visual Studio

    fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HL4JSD9SSV8E": An unhandled exception was thrown by the application. System.Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Module build failed: Error: Missing binding D:\Projects\angular2\node_modules\node-sass\vendor\win32-x64-48\binding.node Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x

    Found bindings for the following environments:

    • Windows 64-bit with Node.js 5.x

    This usually happens because your environment has changed since running npm install. Run npm rebuild node-sass --force to build the binding for your current environment. at module.exports (D:\Projects\angular2\node_modules\node-sass\lib\binding.js:15:13) at Object. (D:\Projects\angular2\node_modules\node-sass\lib\index.js:14:35)

Where have I gone wrong?

John
  • 29,788
  • 18
  • 89
  • 130
Darthg8r
  • 12,377
  • 15
  • 63
  • 100
  • I have the same problem on OSX. Running `npm install --save-dev node-sass` sometimes works temporarily. I haven't isolated the conditions. I'm working on this repo https://github.com/dancancro/jhipster-sample-app-ng2/tree/newmodules – Dan Cancro May 07 '17 at 14:47
  • I don't know if this will help you, but to fix the problem, I changed a Maven configuration in a file called pom.xml that set the node version to something different from the one given by `node -v`. Maybe there's something like that with AspNet – Dan Cancro May 07 '17 at 15:30
  • See my answer on https://stackoverflow.com/questions/40904101 – John Oct 10 '17 at 18:29

3 Answers3

3

On Visual Studio 2017 (15.4.1) you should go to:

  • Tools > Configure External Tools > Projects and Solutions > Web Package Management > External Web Tools

Then reorder the tools as seen below.

External Web Tools

This worked for me.

Davidson Sousa
  • 1,353
  • 1
  • 14
  • 34
1

Visual Studio ships it's own version of Node embedded so that's why you see a mismatch. The TROUBLSHOOTING guide in the repo covers how to work around this https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md#using-node-sass-with-visual-studio-2015-task-runner

nschonni
  • 4,069
  • 1
  • 28
  • 37
1

Deleting node_modules folder and re-installing npm modules using npm install worked for me.

Sreekumar P
  • 5,900
  • 11
  • 57
  • 82