问题
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
. Runnpm 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?
回答1:
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.
This worked for me.
回答2:
Deleting node_modules
folder and re-installing npm modules using npm install
worked for me.
回答3:
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
来源:https://stackoverflow.com/questions/43811639/node-sass-no-binding-for-your-current-environment