Node Sass No Binding for Your current environment - node.js

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?

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.

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

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

Related

Must I install NodeJS when it is already installed by the Visual Studio Installer?

Info
I am using Visual Studio 2019.
The Microsoft guides for creating SPA's requires you to install NodeJS from the official website, at least the guides I have perused so far.
When I installed Visual Studio I selected NodeJS development.
Visual studio installed NodeJS here: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\NodeJs
Question
My goal is to use NodeJS for development and NOT interfere with the operation of Visual Studio AND to only have one version of NodeJS installed AND to avoid installing NVM.
Must I install NodeJS again or should I use the version installed by Visual Studio?
It also raises the following concerns, which I don't expect to get answered here, but it would be nice to know:
If I install it again, will conflicts occur between the two versions?
If conflicts occur, how do I resolve them?
If I use the one installed by Visual Studio, can I update it at will, or does Visual Studio require a specific version of NodeJS?
See also
Multiple versions of node on windows
Install different versions of NodeJS
There was a question posted to the Microsoft Developer Community forums that also addresses this question. Quote:
Thank you for reporting this feedback. The NodeJS workload doesn’t install the Node Runtime and NPM on it’s own. The install you mentioned in the Visual Studio folder is used internally for Visual Studio operations. You would need to install the runtime you want to use separately, which would be picked up by NodeJS workload and corresponding apps.
In response to your question:
Must I install NodeJS again or should I use the version installed by Visual Studio?
Yes - so while it seems a whole separate copy of Node.js and npm is installed under C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VisualStudio\NodeJs when you install Visual Studio (with the Node.js workload), you are meant to install the regular version of Node.js and npm from https://nodejs.org/ and use that in your day-to-day development activities, which is what I've been doing (except with VS2022) and have not encountered any conflicts so far.
Edit: IF you do encounter conflicts with installed Node.js or npm versions, there is a way to resolve them, by changing the order of precedance of paths that VS uses. Go to 'Tools -> Options -> CTRL+E: "External Web Tools"' and you should see this:
Move the $(PATH) entry up or down depending on which version should take priority.
You can check if NodeJS is installed or not using the node -v and check if npm package manager is installed using npm -v. If you find that NodeJS is not installed, then download the NodeJS from here.

NPM error (System.ComponentModel.Win32Exception) in Visual Studio 2015

I need to get started coding an Angular 2 application at my workplace but I get the following error in VS:
====Executing command 'npm install'====
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Microsoft.VisualStudioTools.Project.ProcessOutput..ctor(Process process, Redirector redirector)
Error executing npm - unable to start the npm process
Error - Cannot load global packages.
I've followed Angular 2 VS 2015 QuickStart guide, located here:
https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html
Prerequisites are all installed:
VS 2015 with Update 3
nodeJS v.6.9.1
TypeScript v.2.0.6.0
This error shows up in the output when I open the project or try to do a 'restore packages'
Thanks.
It looks like you need other version of Node. You have maybe too new version of Node I guess. According to this thread: https://github.com/Microsoft/nodejstools/issues/476
you should downgrade and configure VS:
It looks like vs2015 does not work with the latest 5.0.0 Node. Replacing with 4.2.2 one solves this issue for me. To make Visual Stuido use the same Node and npm as cmd by changing some files including node.exe under following folder:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External
Look for this article also http://jameschambers.com/2015/09/upgrading-npm-in-visual-studio-2015/
I finally found out the reason.. nodeJS was installed with the x86 installer on a x64 computer. Installed nodeJS in 64 bit and it resolved my issue.
Hope this help anyone who has this error.

Getting Build Error for Cordova plugin integration on Visual Studio 2015 TACo

This is regarding Cordova based universal app development using Visual Studio 2015 - Tools for Apache Cordova (TACo).
Here is the sample code which I am trying to run: AngularJSToDo app. In this app, there is GeoLocation Cordova plugin is being used. In config.xml:
<vs:plugin name="org.apache.cordova.geolocation" version="0.3.10" />
While building application for Windows Phone Emulator 8.1, it throws an error after below process:
------ Adding plugin: cordova-plugin-geolocation#2.2.0
1> Calling plugman.fetch on plugin "cordova-plugin-geolocation#2.2.0"
1> Fetching plugin "cordova-plugin-geolocation#2.2.0" via plugin registry
1>MDAVSCLI : error : read ECONNRESET
This error appears after a long time fetching event. I have already tried installing particular plugin using "npm" command through command prompt, but VS build automatically clears older plugins and re-download and install latest ones.
In error section, it says
"read ECONNRESET"
Please guide me what should be done to resolve this error from Visual Studio build.
Reference: https://taco.visualstudio.com/en-us/docs/create-a-hosted-app/
Your plugin add is failing because Cordova has closed the Plugin registry and moved to npm. That means all Cordova versions less than 5.x which don't use npm will no longer be able to add plugins.
If you are not on the latest version of TACO, update to make sure that you are on a version that can add a plugin from npm
Then, instructions after updating:
Go to config.xml -> plugins
remove the camera plugin
Add it back in again from the core plugin list
Actually I just ran the sample myself, and had no problem getting it to load on the iOS simulator, but it pulled the plugin from npm and not the plugin registry.
This issue had been resolved by restarting node(npm) server. Below are the steps what I did.
Terminal - Ctrl+C to stop the npm server
Go to particular project folder, and add the plugins using below command
cordova plugin add <plugin-name>
Restart the node server: remotebuild
Hope this helps to others.

Node.js on Azure Website 500 status

I am trying to get a node.js (meanjs) site running on Azure. The site work on my local environment with no errors. But after deployment when I go to my site I get a 500 error in my network tab in chrome. There are no obvious errors to me.
I used https://groups.google.com/forum/#!topic/meanjs/LrHmE43RSvA to walk me through how to set it up with the azure cli.
It is also setup to deploy form my github.
In the Azure portal the deployment dose not fail. I have read through the log and tried to find a problem but im hardly know where to start. Reading through it there are some things that look weird to me for instance. (The log is long and past the character limit or I would have posted it all.)
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. [D:\home\site\repository\node_modules\bson\build\binding.sln]
and there are lots of
npm WARN unmet dependency
Then they all get processed and the files get copped to the wwwroot and finishes successfully.
Some of the things i have tried are changing the deployment branch, deleting the website and starting over. I have
Let me know if there is any thing else that I can add to this post I really want to get this working.
Thanks for any help.
Edit**
I added bson to the .gitignore and got a new error. I am also getting some new errors below is what has changed.
bson#0.2.18 install D:\home\site\repository\node_modules\bson
(node-gyp rebuild 2> builderror.log) || (exit 0)
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.
[D:\home\site\repository\node_modules\bson\build\binding.sln]
npm WARN prefer global coffee-script#1.8.0 should be installed with -g
npm ERR! Error: ENOENT, chmod >'D:\home\site\repository\node_modules\flatiron\bin\flatiron'
npm ERR! If you need help, you may report this entire log,
I also added a .npmignore to the directory but it is blank. I have tried adding both the bson and flatiron to the .gitignore but that did not change the error.
From the log you posted, I can see it failed when azure tried to install an NPM module named bson during the deployment, because there's no VC++ compiler in the virtual machine your azure website located.
It worked well in your machine since you have VC++ installed.
To fix, you'd better compile this module (bson) in your machine (x86 or x64 based on which one selected in your azure website), make this module as included under node_modules folder in your .gitignore so that it will be uploaded when you commit your code.
I have a blog post mentioned this problem and I was using Node.js SQL Server Driver as an example. It also needs VC++ compile.
http://blog.shaunxu.me/archive/2012/11/16/install-npm-packages-automatically-for-node.js-on-windows-azure-web.aspx

error MSB8007 while downloading dependencies with npm and node

I am trying to install some packages in my node app with npm, and I keep getting the error below. I get the same error with socket.io and mongo. I have gone through a number of different errors similar to this, and have install so many different things as per suggestion in other threads that I really have no idea what the problem is. If anyone has any suggestion as to what I need to download/set I would greatly appreciate it.
$ npm install mongodb
npm http GET https://registry.npmjs.org/mongodb
npm http 304 https://registry.npmjs.org/mongodb
npm http GET https://registry.npmjs.org/bson/0.1.9
npm http GET https://registry.npmjs.org/kerberos
npm http 304 https://registry.npmjs.org/bson/0.1.9
npm http 304 https://registry.npmjs.org/kerberos
> kerberos#0.0.2 install c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\kerberos>node "c:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bi
n\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
> bson#0.1.9 install c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\bson>node "c:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\.
.\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'kerberos.vcxp
roj' is invalid. Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specifie
d a non-default Platform that doesn't exist for this project. [c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\kerbero
s\build\kerberos.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'bson.vcxproj'
is invalid. Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a
non-default Platform that doesn't exist for this project. [c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\bson\build\
bson.vcxproj]
mongodb#1.3.9 node_modules\mongodb
├── kerberos#0.0.2
└── bson#0.1.9
VS C++ Express 2010 32bit is free. if you installed 64bit edition of nodejs just remove it and install 32 bit version of the node.js
I had a simallar problem, and this is my solution. I am running windows 7 x64. I installed the x64 version of nodejs. I tried to run install and this is what I got:
At first it wanted me to put git into my path, which I did. then it wanted me to install python (not version 3.x.x but 2.x.x) and put that in my path, which I did. Then I installed visual studio 2010 (c++). after I did all of this I got this error:
D:\Source\xxxx\grunt-raptr\node_modules\node_modules\libxmljs\build\vendor\libxml\libxml.vcxproj(18,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
I read somewhere that if you run it in the visual studio cmd you can make it work, I tried that and I got this error:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'libxml.vcxproj' is invalid. Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Platform that doesn't exist for this project. [D:\Source\xxxx\node_modules\grunt-raptr\node_modules\libxmljs\build\vendor\libxml\libxml.
vcxproj]
Once I saw this I re-installed nodejs with the x32 version and everything worked.
I hope this helps someone.
While trying to install node-inspector: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'bufferutil.vcxproj' is invalid. Platform='x64'
My machine:
Win 7 64bit
node 0.12.7 64bit
Python 2.7 64bit
How I fixed it with all the advice found on the nets:
Uninstall all VC++ 20xx Redistributables
(use this MS FixIt if the uninstall fails)
Install Microsoft Windows SDK for Windows 7
Select only Visual C++ Compilers
Run npm install -g node-inspector --python="C:\Python27\python.exe"
If that still doesn't work try this:
install the MS SDK x64 Libraries
add this line 'AdditionalLibraryDirectories': 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib\\x64', in every addon.gypi you find
C:\nodejs\node_modules\node-gyp\addon.gypi
C:\Users\YOU\.node-gyp\0.12.7\deps\npm\node_modules\node-gyp\addon.gypi
?
addon.gypi:
...
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [ 'iojs.exe', 'node.exe' ],
# Don't print a linker warning when no imports from either .exe
# are used.
'AdditionalOptions': [ '/ignore:4199' ],
# THIS LINE HERE
'AdditionalLibraryDirectories': 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib\\x64',
},
...
Good luck!

Resources