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

Windows users are not happy. #629

Closed
luisrudge opened this issue May 22, 2015 · 474 comments
Closed

Windows users are not happy. #629

luisrudge opened this issue May 22, 2015 · 474 comments
Labels

Comments

@luisrudge
Copy link

It all started with this conversation.

As I said, I'm pretty much a newbie and I don't even know what node-gyp does, but what I DO know is that it's a pain to run Windows and install a project with node-gyp as a dependency.
Some numbers:

It's bizarre that a nodejs developer needs to install visual studio (even the express edition) in order to be able to work on Windows. Even more bizarre is that I, as a .NET developer with full visual studio installed in my machine still can't download a bunch of projects that use this project.

With that being said, I'd like to know from all of you what should we do to make windows users fall in the pit of success? What are the alternatives? Does Microsoft can solve this in any way?

This issue is fixed (kinda)

@mousetraps pointed that Microsoft is shipping the C++ build tools separately now. Check here

Some updates on this gigantic thread

Absolutely non-official statement that @microsoft is aware of this issue and seeing what can be done

@mousetraps said that this thread "is high on people's radar" at @microsoft

Very good Q&A about noge-gyp issues on Windows and why they happen

@dekarguy took the time to answer some questions about what we all are going through

@johanalkstal
Copy link

+1
Is there some common effort we can do?

The reliance on both Visual Studio (or the Windows SDK) and Python is such a pain. And when it still doesn't work 99.9/100 times anyway, while node-gyp still being so heavily used by the Node community, it's enough to make a grown man cry or give up on using whatever it was that relied on node-gyp.

@daanl
Copy link

daanl commented May 22, 2015

+1 this a world of pain, took me hours to install a project with node_gyp

@joeeames
Copy link

+1 after 8+ hours of trying, still can't use anything that relies on node-gyp.

@GradyD
Copy link

GradyD commented May 23, 2015

👍 after multiple days trying to get this to install I am still fighting VS errors!! It just never gives up.

Atwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript.

@luisrudge
Copy link
Author

@TooTallNate any thoughts?

@TooTallNate
Copy link
Contributor

node-gyp v2.0.0 (just released) has an updated gyp version that adds support for MSVS 2015, and should hopefully ease of lot of this pain for Windows users.

@TooTallNate
Copy link
Contributor

Additionally, you guys should probably support my current effort in bringing FFI into node core, thus eliminating node-gyp from the equation for the majority of use-cases.

@luisrudge
Copy link
Author

Awesome @TooTallNate. I don't have the skills to understand and support your argument, but I can give you a 👍 haha :(

Congratz on the new release, but I believe we have to wait for everyone to update the dependency version and that maybe never happens.

@b-long
Copy link

b-long commented May 28, 2015

I'm also struggling with this quite a bit. I'm trying to follow along with this guide (https://github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup), but I'm not having much luck.

The guide in the wiki directs us to http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express, which redirects to https://www.visualstudio.com/downloads/download-visual-studio-vs#d-2010-express and that page does not offer VS 2010 for download (it's exclusively 2013).

Even more hilarious / sad, in attempting the uninstall procedures, I somehow wound up with "Microsoft Visual Studio 2010 Service Pack 1" listed in my Programs and Features (Uninstall menu), but when I click "Uninstall/Change", I'm given an error after a while that says "A compatible version of Visual Studio 2010 was not detected on the system. This update is designed for only the Microsoft Visual Studio 2010."

@luisrudge
Copy link
Author

Yeah. There needs to be a better way

@b-long
Copy link

b-long commented May 29, 2015

@TooTallNate I'm pretty sure you're doing the best work there is for Node support on Windows 👍 :) Could I make a request that we update the wiki page (or add a new wiki page) describing the steps for VS 2015 ?

@luisrudge
Copy link
Author

FYI: npm i c3 still fails. Even with vs2015 installed. @TooTallNate any ideas?

@luisrudge
Copy link
Author

c:\git\rr\MyProject\src (master)
? npm i -S c3
npm WARN package.json package@0.0.0 No description
npm WARN package.json package@0.0.0 No repository field.
npm WARN package.json package@0.0.0 No README data
npm WARN package.json package@0.0.0 No license field.
-


> contextify@0.1.14 install c:\git\rr\MyProject\src\node_modules\c3\node_modules\d3\node_modules\jsdom\node_modules\contextify
> node-gyp rebuild

\
c:\git\rr\MyProject\src\node_modules\c3\node_modules\d3\node_modules\jsdom\node_modules\contextify {git}
{lamb} if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (rebuild)
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 534, in script_main
    return main(sys.argv[1:])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 527, in main
    return gyp_main(args)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 503, in gyp_main
    options.circular_check)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 98, in Load
    generator.CalculateVariables(default_variables, params)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1867, in CalculateVariables
    generator_flags.get('msvs_version', 'auto'))
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 402, in SelectVisualStudioVersion
    versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2015'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:343:16)
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.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
cwd c:\git\rr\MyProject\src\node_modules\c3\node_modules\d3\node_modules\jsdom\node_modules\contextify
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "-S" "c3"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code ELIFECYCLE

npm ERR! contextify@0.1.14 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.14 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\git\rr\MyProject\src\npm-debug.log

@b-long
Copy link

b-long commented Jul 9, 2015

I just found out about the environment variable (GYP_MSVS_VERSION ) option here: #339 (comment) , it might help @luisrudge or others. Any other updated happy paths for Windows users? /cc @TooTallNate @isaacs

@srlowe
Copy link

srlowe commented Jul 22, 2015

+1 This is a real pain point - I'm spending as much time fiddling around with VS and node-gyp as I am coding at the moment. IMO the core of the problem is all these MS/VS dependencies, which are a total mess - is there any way we could circumvent these?

@aahoo
Copy link

aahoo commented Jul 25, 2015

+1000
More than two days working to figure out this gyp thing. The problem is I can't give up.

@Sogl
Copy link

Sogl commented Jul 28, 2015

+100500!
Much pain with 'node-gyp'! 15 GB of Visual Studio versions/SP/tools downloaded...

For windows 7 I use VS 2010 and SDK 7.1 command prompt. This instruction can help:
https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/

With Windows 8.1 pro and VS 2013 Express and SDK 8.1 I'm still get this error:

  bufferutil.cc
..\src\bufferutil.cc(7): fatal error C1083: Не удается открыть файл включение:
v8.h: No such file or directory [C:\Users\Артем\AppData\Roaming\npm\node_module s\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_module s\engine.io-client\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcx proj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269: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.3.9600
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Артем\AppData\Roaming\npm\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.1.0
npm WARN optional dep failed, continuing bufferutil@1.1.0

Now I'm downloading VS 2013 Community (#644)

Update.
VS2013 Community version not helps..#676 created

@aahoo
Copy link

aahoo commented Jul 29, 2015

@Sogl

I installed socket.io with MSVS version set and then installed the rest of the stuff:

npm install socket.io --msvs_version=2015
npm install

Note: I had Visual Studio 2015

I hope this helps if not you can look @ socket.io / issues.

@Sogl
Copy link

Sogl commented Jul 29, 2015

@Baazoo

Can't install with 2013/2010:

C:\Users\Артем>npm install -g socket.io --msvs_version=2013

> bufferutil@1.1.0 install C:\Users\Артем\AppData\Roaming\npm\node_modules\socke
t.io\node_modules\bufferutil
> node-gyp rebuild


C:\Users\Артем\AppData\Roaming\npm\node_modules\socket.io\node_modules\bufferuti
l>if not defined npm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-
gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  reb
uild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, до
бавьте параметр "/m".
  bufferutil.cc
..\src\bufferutil.cc(7): fatal error C1083: Cannot open include file: 'v8.h': N
o such file or directory [C:\Users\Артем\AppData\Roaming\npm\node_modules\socke
t.io\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modul
es\node-gyp\lib\build.js:269: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.3.9600
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Артем\AppData\Roaming\npm\node_modules\socket.io\node_modu
les\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No description
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No repository field.
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No README data
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js" "install" "-g" "socket.io" "--msvs_version=2013"
npm ERR! node v0.12.7
npm ERR! npm  v3.2.0
npm ERR! code ELIFECYCLE

npm ERR! bufferutil@1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@1.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Артем\npm-debug.log

C:\Users\Артем>npm install -g socket.io --msvs_version=2010

> bufferutil@1.1.0 install C:\Users\Артем\AppData\Roaming\npm\node_modules\socke
t.io\node_modules\bufferutil
> node-gyp rebuild


C:\Users\Артем\AppData\Roaming\npm\node_modules\socket.io\node_modules\bufferuti
l>if not defined npm_config_node_gyp (node "C:\nodejs\node_modules\npm\bin\node-
gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  reb
uild )
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, до
бавьте параметр "/m".
  bufferutil.cc
..\src\bufferutil.cc(7): fatal error C1083: Cannot open include file: 'v8.h': N
o such file or directory [C:\Users\Артем\AppData\Roaming\npm\node_modules\socke
t.io\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modul
es\node-gyp\lib\build.js:269: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.3.9600
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Артем\AppData\Roaming\npm\node_modules\socket.io\node_modu
les\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No description
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No repository field.
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No README data
npm WARN EPACKAGEJSON C:\Users\Артем\AppData\Roaming\npm No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js" "install" "-g" "socket.io" "--msvs_version=2010"
npm ERR! node v0.12.7
npm ERR! npm  v3.2.0
npm ERR! code ELIFECYCLE

npm ERR! bufferutil@1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@1.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Артем\npm-debug.log

C:\Users\Артем>

@b-long
Copy link

b-long commented Jul 29, 2015

The root of this issue is that Microsoft's willingness to provide a c/c++ compiler on Windows is lackluster. Right? Is there not some other approach (e.g. using a Cygwin DLL or something from MinGW ) that might suffice?

@aahoo
Copy link

aahoo commented Jul 30, 2015

@Sogl
I didn't follow from the beginning. Take a look at Updating npm's bundled node gyp if you already haven't.

@thoroc
Copy link

thoroc commented Jul 30, 2015

Other solution would be to settle a non MSFT compiler and use one that is still available for the plateform.

@Sogl
Copy link

Sogl commented Jul 30, 2015

@Baazoo

Didn't help.

@thoroc

Also found info about build with pangyp:

npm i pangyp -g
npm config set node-gyp pangyp

Also this tool works with io.js.
For me it doesn't work because my userprofile name in Russian.
But it still use MS compiler...

@thoroc
Copy link

thoroc commented Jul 30, 2015

Well I am resorting to install a VM with Ubuntu on it for dev. But I am not really happy to have to change OS just because node-gyp is forcing me into installing MSFT dev tooling. From I have read changing to an FOSS C++ compiler would mean a major refactoring of the tool itself. Which incidently and understandly, no one wants to undertake.

@aahoo
Copy link

aahoo commented Jul 30, 2015

@Sogl
I just encounterd similar issue when trying to install gulp-devtools.

c:\users\hamed\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083
: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\h
amed\AppData\Roaming\npm\node_modules\gulp-devtools\node_modules\socket.io\node
_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
  validation.cc
c:\users\hamed\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083
: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\h
amed\AppData\Roaming\npm\node_modules\gulp-devtools\node_modules\socket.io\node
_modules\socket.io-client\node_modules\ws\build\validation.vcxproj]

This is what worked for me:

  1. Switched terminal from Powershell to CMD (Powershell didn't work)
  2. set GYP_MSVS_VERSION=2015
  3. Installed the package in my case npm install -g gulp-devtools

There is one more suggestion!

@Sogl
Copy link

Sogl commented Jul 30, 2015

@Baazoo
Just tried things you describe.
Same 'v8.h' error =(

One last step that I want to try - install VS 2015 😆

@b-long
Copy link

b-long commented Jul 30, 2015

I also resorted to the workflow @thoroc described (using a VM inside Windows).

@Sogl
Copy link

Sogl commented Jul 30, 2015

@thoroc
@b-long

Yep, guys. This problem also has led me to use Vagrant (with VirtualBox) and Scotch Box.

@luisrudge
Copy link
Author

Sorry. The solution can't be "use a vm instead"

@galeksandrp
Copy link

galeksandrp commented Apr 22, 2016

@jasonwilliams200OK, yes, but file from patch you referred is .gypi file, when gyp is written in python. And look, there are references to DirectX SDK in it (which obviously not needed to be used in crossplatform buildsystem.

@ghost
Copy link

ghost commented Apr 22, 2016

there are references to DirectX SDK in it

@galeksandrp, the patch I linked is highlighting the portion of gypi fix which anyone can apply locally. You missed the point, which was this particular issue (among dozens of others discussed in this thread) can be fixed in gyp.

To your meticulous concern, in node-gyp crossplatform buildsystem scenario, modify ~\.node-gyp\<version>\include\node\common.gypi or node_modules\node-gyp\addon.gypi file to add these dirs (suiting your drive letter and exact version of latest available SDK):

'include_dirs': [
  'C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/um',
  'C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/shared',
  'C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/ucrt',
  'C:/Program Files (x86)/Windows Kits/10/Include/10.0.10586.0/winrt'
],

This will make the node.js package with C++ add-on compile with Windows 10 SDK, without having to install Windows 8 SDK.

@ericgrosse
Copy link

ericgrosse commented Apr 22, 2016

For those still having node-gyp issues, please try the following:

Step 1

Make sure you have the latest version of Node. Right now it is v5.11.0 Stable and includes an up-to-date version of npm. Even if you apply legitimate fixes found in this thread, you will still get node-gyp errors using an outdated version of Node or npm.

Step 2

Use Mousetrap's solution, found here. You don't even need to read her full post, just blindly follow steps 1-4 that she provides.

Step 2

If you're getting an error ImportError: No module named gyp, it means you need to reconfigure how npm accesses the python shell. The instructions are given here.


I have tried this setup on three different OSes (Windows 7, Windows 8.1, Windows 10) and it always works. You don't need Visual Studio, just the Visual C++ Build Tools 2015.

As an additional note: I always run npm install from a git bash terminal that's run as administrator.

@fskreuz
Copy link

fskreuz commented Apr 24, 2016

Confirming that @mousetraps method still works as of the time of writing with no additional steps.

OS: Microsoft Windows 10 Pro N (Build 10586)
Node: 5.11.0
npm: 3.8.6

Notes:

  • Git Bash isn't required to run as administrator.
  • No Visual Studio required.
  • No Windows SDK required.
  • Install the Visual C++ Build Tools 2015 Technical Preview, not Visual C++ Build Tools 2015.
    • If you installed it without having to select "Custom", you probably got the wrong one installed.
    • If you encounter an error containing MSB4019, you probably got the wrong one installed.
  • No environment variables required.
    • You only need npm config set msvs_version 2015 --global
    • If you set GYP_MSVS_VERSION, you can unset that.
    • If you did some env var or regedit hacking like this, you probably need to undo those.

@barocsi
Copy link

barocsi commented May 1, 2016

According to @fskreuz if you had this set during your struggle, make sure its updated to the most recent version
SET VCTargetsPath=C:\Program Files (x86)\MSBUILD\Microsoft.Cpp\v4.0\V120
for me its v140

@am11
Copy link

am11 commented May 1, 2016

@barocsi, note that if you have latest msbuild in PATH, then you do not need to set VCTargetsPath:

SET PATH=C:\Program Files (x86)\MSBUILD\14.0\Bin;%PATH%

In fact, you should rather unset it if it is set as process, user or machine env variable; because if you have multiple VS versions installed, fixing this environment variable to a version will led to other kinds of build errors. VCTargetsPath is usually set in vcxproj explicitly or via the MSBuild default .targets.

@barocsi
Copy link

barocsi commented May 1, 2016

Then it might have only worked for my particular bad chain of setups. Will clean up again, thanks.

@Ucodia
Copy link

Ucodia commented May 2, 2016

Where did @mousetraps comment go? It contained the full step by step guide but it looks like it has been deleted.

Edit: My bad, a low connectivity prevented my browser from showing the comment as @jasonwilliams200OK mentioned.

@ghost
Copy link

ghost commented May 2, 2016

@Ucodia, that comment is still there. The page size is crazy long though, probably that's why browser must be acting funny. I vouch to open a part two of this issue for persistently unhappy users. 😄

@frankred
Copy link

frankred commented May 4, 2016

Having done the following steps still does not work:

  1. Installing Windows10
  2. Installing node v.4.4.3 (LTS)
  3. Updating npm to 3.8.8
  4. Installed python 2.7.11 and added to path
  5. Installing "VC++ Build Tools Technical Preview" https://www.microsoft.com/en-us/download/confirmation.aspx?id=49983
  6. npm install node-expat@2.3.13

finally getting this error:

Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu ermöglichen, müssen Sie den Schalter "/m" hinzufügen.
  xmlparse.c
  xmltok.c
  xmlrole.c
  win_delay_load_hook.c
..\..\..\deps\libexpat\lib\xmlparse.c(5): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory [C:\_js\cme-co
ntent-crawler-suppilo\node_modules\node-expat\build\deps\libexpat\expat.vcxproj]
..\..\..\deps\libexpat\lib\xmltok.c(5): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory [C:\_js\cme-cont
ent-crawler-suppilo\node_modules\node-expat\build\deps\libexpat\expat.vcxproj]
..\..\..\deps\libexpat\lib\xmlrole.c(5): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory [C:\_js\cme-con
tent-crawler-suppilo\node_modules\node-expat\build\deps\libexpat\expat.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h(31): fatal error C1083: Cannot open include file: 'ctype.h': No such file or dir
ectory (compiling source file C:\Users\froth\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c) [C:\_js\
cme-content-crawler-suppilo\node_modules\node-expat\build\deps\libexpat\expat.vcxproj]
g

Sorry for spamming more, but is this a node-gyp?

@mikew
Copy link

mikew commented May 4, 2016

Definitely still not able to build things here without Visual Studio proper.

Installed:

  • Windows 10
  • node v5.11.0
  • npm v3.8.6
  • python v2.7.11
  • Microsoft Visual C++ Compiler for Python 2.7
  • Microsoft Visual C++ Build Tools 2015 Technical Preview
  • Windows 8.1 SDK
  • Windows 10 SDK
  • npm config set msvs_version 2015
  • npm config set python python

Test:

npm install node-sass
cd node_modules\node-sass
del vendor\win32-x64-47\binding.node
node scripts\build.js

MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "14.0", "4.0".

Build FAILED.

  MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "14.0", "4.0".

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.20
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:\Users\mike\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mike\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\mike\node_modules\node-sass
gyp ERR! node -v v5.11.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
Build failed

@ghost
Copy link

ghost commented May 14, 2016

So, do we still need to download and install the entire Visual Studio package just to install a couple native node modules that require node-gyp? Seems kind of excessive to me, the VS package is insanely large, takes a bit to install and also installs tons of MYSQL useless packages that you need to uninstall AFTER. Please tell me there is a solution to this. (Obviously, running it on Linux it only needs gcc and some other deps, which is fine) -- but I dev on Windows :(

Also, where the fuck is Ryan Dahl? He should be working on node still. Where did he go?

Edit2: Also why hasn't Github implemented pagination on issue pages? What a mess.

@luisrudge
Copy link
Author

@Dillybob92 no. You just need to download the msbuild tools: #629 (comment)

@luisrudge
Copy link
Author

@Dillybob92 BTW, your tone doesn't help anyone.

@ghost
Copy link

ghost commented May 14, 2016

@luisrudge My tone? This has been a problem for years and for Ryan Dahl to leave node and leave a mess for the community is a disgrace.

Also, mousetraps post is not really a solution. That's still around 8 Gigabytes of SDK's. I'd rather just install VS 2013 express.. Also, those SDK's installers don't offer a custom installation folder. This is still a major issue that no one seems to address so my tone will stay the same.

@luisrudge
Copy link
Author

@Dillybob92 I understand it's not ideal, but it is what it is.
It's not 8GB, it's less than 800mb for just the build tools. You don't need the full SDK.

orangemocha pushed a commit that referenced this issue May 17, 2016
* Point to the latest release of the VC++ Build Tools.
* Simplify and consolidate install instructions for all Windows versions.

PR-URL: #867
Fixes: #629
Reviewed-By: orangemocha - Alexis Campailla <orangemocha@nodejs.org>
Reviewed-By: thealphanerd - Myles Borins <myles.borins@gmail.com>
@orangemocha
Copy link
Contributor

Fixed with 0880827

@AndrewPardoe
Copy link

One more note on this thread: the Visual C++ Build Tools are located here: http://landinghub.visualstudio.com/visual-cpp-build-tools

@am11
Copy link

am11 commented Jun 10, 2016

@AndrewPardoe thanks for sharing the link.

On that same page, it is mentioned that there is also a NuGet feed available for VC++ latest build tools, which we can incorporate in our node.js build process for targets where there C++ compiler is missing, using nuget.exe (the executable is wget'able from here).
For example, in PowerShell:

# download nuget
wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile nuget.exe

# install VC build tools
./nuget install VisualCppTools -source http://vcppdogfooding.azurewebsites.net/nuget/ -Prerelease

Although this is one huge download, but still might come handy for someone to unblock their users from not getting the npm packages installed at all, and automate the build process for them.

@sebastienguillon
Copy link

sebastienguillon commented Jun 10, 2016

Success installing npm bcrypt module on windows 10

  • nodejs version: 4.4.5
  • npm version: 2.15.5
  • bcrypt version 0.8.7

System 1 (desktop)
Windows 10 - Pro - 64 bits - FRENCH
Intel Core i7-3770 CPU @ 3.40GHz
16 GB RAM

System 2 (laptop)
Dell XPS 15 9550
Windows 10 - Family - 64 bits - FRENCH
Intel Core i7-6700HQ CPU @ 2.60GHz
16 GB RAM


The steps I will detail here, as well as the output, are those from system 1 (but the steps were the same on system 2).
I am not claiming any of these steps are the correct ones, but they do reflect the sequence that led to a successful install of the bcrypt npm module (version 0.8.7, as of june 10, 2016).

STEP 1
Perform full installation of C++ Build Tools 2015 (from: https://blogs.msdn.microsoft.com/vcblog/2016/03/31/announcing-the-official-release-of-the-visual-c-build-tools-2015/)
(I say full install because this is what I did, however I don't claim that the full install is necessary)
Note: this may take a while as the full program is over 4GB

STEP 2
Install Python 2.7.11 (from: https://www.python.org/)
Note: during installation select the "add to PATH" option (which is not selected by default)

STEP 3
Run:
npm config set msvs_version 2015 --global
Note: I ran it as administrator in Windows cmd.exe

STEP 4
In my NodeJS project folder (a little blog app i am writing to learn NodeJS), I then ran the install command:
npm install bcrypt --save

This is the output I got (********** asterisks are simply used to hide my local project folder path):

npm WARN package.json blog@1.0.0 No repository field.
npm WARN package.json blog@1.0.0 No README data

> bcrypt@0.8.7 install D:\**********\blog\node_modules\bcrypt
> node-gyp rebuild


D:\**********\blog\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Génération des projets individuellement dans cette solution. Pour activer la génération en parallèle, ajoutez le commutateur "/m".
  blowfish.cc
  bcrypt.cc
  bcrypt_node.cc
..\src\bcrypt.cc(232): warning C4267: '=': conversion from 'size_t' to 'unsigned char', possible loss of data [D:\**********\blog\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
..\src\bcrypt_node.cc(76): warning C4244: 'argument': conversion from 'ssize_t' to 'unsigned char', possible loss of data [D:\**********\blog\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
..\src\bcrypt_node.cc(229): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data [D:\**********\blog\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
..\src\bcrypt_node.cc(230): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data [D:\**********\blog\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
  win_delay_load_hook.c
     Creating library D:\**********\blog\node_modules\bcrypt\build\Release\bcrypt_lib.lib and object D:\**********\blog\node_modules\bcrypt\build\Release\bcrypt_lib.exp
  Generating code
  Finished generating code
  bcrypt_lib.vcxproj -> D:\**********\blog\node_modules\bcrypt\build\Release\\bcrypt_lib.node
bcrypt@0.8.7 node_modules\bcrypt
+-- bindings@1.2.1
+-- nan@2.3.5

I am now able to run bcrypt() commands in my NodeJS app, they turn out something like:

$2a$10$pDJX6lz6QBVatYCC.KiOJ.q6t6uAlKxRsny9tEPiSHTMhNBIhymW2

I have no way of knowing if these hashes are perfect bcrypt hashes be they look good to me.

I would appreciate any input regarding the importance of the warnings referenced in the output above.

Thanks to all who contributed to this thread :)

@orangemocha
Copy link
Contributor

This issue was addressed with the release of the VC++ Build Tools, and an updated list of instructions for Windows developers both in the node-gyp README and in the new https://github.com/Microsoft/nodejs-guidelines repo.

For any further problems, bug reports, suggestions, etc. related to installing/compiling native modules, please open a new issue in this repo, or at https://github.com/nodejs/node, or - if the issue is pertinent to a specific module and not to node/nodegyp in general - in the module's own issue tracker. I believe those avenues will be more productive than continuing to comment on this giant thread, so I am locking it now.

Thanks again to everybody who contributed to the discussion and resolution! 😄

@nodejs nodejs locked and limited conversation to collaborators Jun 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests