kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.45k stars 513 forks source link

Error: no error (Windows 8) #143

Closed medikoo closed 11 years ago

medikoo commented 11 years ago

I've got problem with bcrypt on Windows 8 machine.

Compilation runs well, but whenever I try to use bcrypt, script crashes with Error: no error. I'm attaching two screenshots. First output of compilation (npm install, and second output of npm test).

screenRealError6

bcryptTestlog

defunctzombie commented 11 years ago

I think there is a build error. The last line of the warnings looks possibly suspicious to me. My recommendation? Stop using windows ;)

medikoo commented 11 years ago

@shtylman that's a childish recommendation, you can't ask millions of people to stop using Windows, just because you have bad opinion about it ;-)

For this project I definitely need Windows support, and that's not a solution.

ncb000gt commented 11 years ago

@medikoo Can you put together a small code sample that replicates the behavior and share that code with us. From the line numbers it appears as if that is coming from calling bindings.encrypt_sync(). So, use bcrypt.encrypt_sync() in your example please (or any others if you find them to also produce the same result).

medikoo commented 11 years ago

@ncb000gt it fails right at require('bcrypt'). I'm not able to try any specific function

ncb000gt commented 11 years ago

I see you're using 0.7.3 of the module (there should be an upgrade for that). Also, which version of node are you using? It may be in there but I didn't see it.

medikoo commented 11 years ago

@ncb000gt sorry, indeed it was outdated. I've updated it to v0.7.4 and it's same error. We're using latest version of Node (v.0.8.21)

image

defunctzombie commented 11 years ago

How was node installed? The download binary or built from source?

Also, if you can open up access to a windows machine then we may be able to help resolve this. Windows 8 is not some free software I can just download to help you fix this :)

On Fri, Mar 1, 2013 at 12:26 PM, Mariusz Nowak notifications@github.comwrote:

@ncb000gt https://github.com/ncb000gt sorry, indeed it was outdated. I've updated it to v0.7.4 and it's same error. We're using latest version of Node (v.0.8.21)

[image: image]https://f.cloud.github.com/assets/122434/210551/04e186b0-8295-11e2-81ca-b56ad582200a.jpeg

— Reply to this email directly or view it on GitHubhttps://github.com/ncb000gt/node.bcrypt.js/issues/143#issuecomment-14300703 .

medikoo commented 11 years ago

Node was installed regular way (using official binary).

It's on computer of my colleague, so I'll ask him about possible access, but it'll be possible Monday earliest. I let you know then.

On other Windows 8 machine I've installed bcrypt without issues. The only difference I know between both systems, is that one that has this issue is French language version (not sure if it makes any real difference).

TooTallNate commented 11 years ago

"Error: No error" coming from the .node native require call... hm.. that is strange... it could possibly be a bug in the libuv dynamic loader. Pinging @piscisaureus / @sblom.

medikoo commented 11 years ago

@TooTallNate @piscisaureus We've checked also v0.9 Node branch and got exactly same error. If you'd like to get some more information, please let us know what you need, and I'll do my best.

I confirm that we can also setup a TeamViewer session with direct access to the machine if that can help.

piscisaureus commented 11 years ago

I remember having heard of this problem before, and iirc it was caused by loading a module compiled for x64 by the x86 variant of node. My first suggestion would be to verify that the architectures of node.exe and bcrypt.node match.

That said, the error is a bit odd. If you have compiled node from source you could try setting breakpoints in uv_dlopen and uv_dlsym and figure out what the error is that windows reports.

medikoo commented 11 years ago

@piscisaureus this can't be the case, as we're doing npm test right after npm rebuild in the same command shell window. So we're definitely using same variant of node for both compilation and loading the module afterwards.

I don't have any experience with compilation of Node on Windows. We're installing node using msi binaries as they're provided at nodejs.org, and I'm totally not familiar w C++, but if you guide us, in few simple steps, how we should set such breakpoints and compile, we can do that, and post the log.

defunctzombie commented 11 years ago

You could have still install the wrong architecture for node.exe. The build would be separate from that but then fail to run. So the fact that you run npm test after npm install doesn't say anything about the arch of the exe installed. On Mar 4, 2013 6:03 AM, "Mariusz Nowak" notifications@github.com wrote:

@piscisaureus https://github.com/piscisaureus this can't be the case, as we're doing npm test right after npm rebuild in the same command shell window. So we're definitely using same variant of node for both compilation and loading the module afterwards.

I don't have any experience with compilation of Node on Windows. We're installing node using msi binaries as they're provided at nodejs.org, and I'm totally not familiar w C++, but if you guide us, in few simple steps, how we should set such breakpoints and compile, we can do that, and post the log.

— Reply to this email directly or view it on GitHubhttps://github.com/ncb000gt/node.bcrypt.js/issues/143#issuecomment-14375330 .

medikoo commented 11 years ago

@shtylman it's a 64-bit system and there's x64 Node.js installed

piscisaureus commented 11 years ago

My first suggestion would be to verify that the architectures of node.exe and bcrypt.node match.

You did that?

medikoo commented 11 years ago

@piscisaureus As I mentioned, we've run npm test right after npm rebuild, and we didn't reinstall node in between. So error is thrown by exactly same node that compiled the module.

According to version of Node we're using, if nodejs.org website hosts x64 versions under x64 links, then it's definitely that. We've done additional sanity check:

node -e "console.log(process.arch, require('os').arch())"
x64 x64

We can also do some extra sanity check on bcrypt.node, but I'm not sure how I can check architecture of that, let me know the method, and we'll apply it.

TooTallNate commented 11 years ago

We can also do some extra sanity check on bcrypt.node, but I'm not sure how I can check architecture of that, let me know the method, and we'll apply it.

Try GNU file: http://gnuwin32.sourceforge.net/packages/file.htm

defunctzombie commented 11 years ago

On Mar 4, 2013, at 11:05 AM, Mariusz Nowak notifications@github.com wrote:

@piscisaureus As I mentioned, we've run npm test right after npm rebuild, and we didn't reinstall node in between. So error is thrown by exactly same node that compiled the module.

Node does not compile the module. It is compiled by gyp which is a python script. So it is still possible for the build arch to not match.

According to version of Node we're using, if node.js website hosts x64 versions under x64 links, then it's definitely that. We've done additional sanity check:

node -e "console.log(process.arch, require('os').arch())" x64 x64

Ok, so node is x64, but still need to verify the bcrypt.node file.

We can also do some extra sanity check on bcrypt.node, but I'm not sure how I can check architecture of that, let me know the method, and we'll apply it.

— Reply to this email directly or view it on GitHub.

piscisaureus commented 11 years ago

@medikoo

Use dumpbin /headers <filename> and look for the machine header which should be one of the first. You can use dumpbin from the visual studio command prompt.

C:\Program Files (x86)\nodejs>dumpbin /headers node.exe
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file node.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
             14C machine (x86)

... etc ...
medikoo commented 11 years ago

Ok, so using dumpbin on _bcryptlib.node we get:

FILE HEADER VALUES
            8664 machine (x64)

Full log of dumpbin /headers bcrypt_lib.node:

Microsoft (R) COFF/PE Dumper Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file bcrypt_lib.node

PE signature found

File Type: DLL

FILE HEADER VALUES
            8664 machine (x64)
               6 number of sections
        5134597B time date stamp Mon Mar 04 09:21:15 2013
               0 file pointer to symbol table
               0 number of symbols
              F0 size of optional header
            2022 characteristics
                   Executable
                   Application can handle large (>2GB) addresses
                   DLL

OPTIONAL HEADER VALUES
             20B magic # (PE32+)
           11.00 linker version
            DE00 size of code
            D000 size of initialized data
               0 size of uninitialized data
            4F04 entry point (0000000180004F04) _DllMainCRTStartup
            1000 base of code
       180000000 image base (0000000180000000 to 000000018001DFFF)
            1000 section alignment
             200 file alignment
            6.00 operating system version
            0.00 image version
            6.00 subsystem version
               0 Win32 version
           1E000 size of image
             400 size of headers
               0 checksum
               2 subsystem (Windows GUI)
             160 DLL characteristics
                   High Entropy Virtual Addresses
                   Dynamic base
                   NX compatible
          100000 size of stack reserve
            1000 size of stack commit
          100000 size of heap reserve
            1000 size of heap commit
               0 loader flags
              10 number of directories
           167A0 [      54] RVA [size] of Export Directory
           15844 [      50] RVA [size] of Import Directory
           1C000 [     1E0] RVA [size] of Resource Directory
           1B000 [     D50] RVA [size] of Exception Directory
               0 [       0] RVA [size] of Certificates Directory
           1D000 [     424] RVA [size] of Base Relocation Directory
            F3F0 [      38] RVA [size] of Debug Directory
               0 [       0] RVA [size] of Architecture Directory
               0 [       0] RVA [size] of Global Pointer Directory
               0 [       0] RVA [size] of Thread Storage Directory
           141C0 [      70] RVA [size] of Load Configuration Directory
               0 [       0] RVA [size] of Bound Import Directory
            F000 [     360] RVA [size] of Import Address Table Directory
               0 [       0] RVA [size] of Delay Import Directory
               0 [       0] RVA [size] of COM Descriptor Directory
               0 [       0] RVA [size] of Reserved Directory

SECTION HEADER #1
   .text name
    DD6F virtual size
    1000 virtual address (0000000180001000 to 000000018000ED6E)
    DE00 size of raw data
     400 file pointer to raw data (00000400 to 0000E1FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         Execute Read

SECTION HEADER #2
  .rdata name
    77F4 virtual size
    F000 virtual address (000000018000F000 to 00000001800167F3)
    7800 size of raw data
    E200 file pointer to raw data (0000E200 to 000159FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

  Debug Directories

        Time Type       Size      RVA  Pointer
    -------- ------ -------- -------- --------
    5134597B cv           7A 00014230    13430    Format: RSDS, {81352293-7274-4605-95D8-041C9F1276DE}, 2, F:\git\Lomas-eRegistrations\eregistrations-lomas\node_modules\bcrypt\build\Release\bcrypt_lib.pdb
    5134597B feat         10 000142AC    134AC    Counts: Pre-VC++ 11.00=0, C/C++=134, /GS=134, /sdl=0

SECTION HEADER #3
   .data name
    3890 virtual size
   17000 virtual address (0000000180017000 to 000000018001A88F)
    1600 size of raw data
   15A00 file pointer to raw data (00015A00 to 00016FFF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0000040 flags
         Initialized Data
         Read Write

SECTION HEADER #4
  .pdata name
     D50 virtual size
   1B000 virtual address (000000018001B000 to 000000018001BD4F)
     E00 size of raw data
   17000 file pointer to raw data (00017000 to 00017DFF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

SECTION HEADER #5
   .rsrc name
     1E0 virtual size
   1C000 virtual address (000000018001C000 to 000000018001C1DF)
     200 size of raw data
   17E00 file pointer to raw data (00017E00 to 00017FFF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
40000040 flags
         Initialized Data
         Read Only

SECTION HEADER #6
  .reloc name
     C48 virtual size
   1D000 virtual address (000000018001D000 to 000000018001DC47)
     E00 size of raw data
   18000 file pointer to raw data (00018000 to 00018DFF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
42000040 flags
         Initialized Data
         Discardable
         Read Only

  Summary

        4000 .data
        1000 .pdata
        8000 .rdata
        1000 .reloc
        1000 .rsrc
        E000 .text
defunctzombie commented 11 years ago

Any update on this?

medikoo commented 11 years ago

Issue remains persistent on our side. Let us know what additional info you need, and we'll provide it. We can also setup remote team viewer session.

ncb000gt commented 11 years ago

@piscisaureus Any ideas from the latest info @medikoo provided?

piscisaureus commented 11 years ago

I tried really hard to reproduce this error but to no avail, so I have no clue what's going on. I'm pretty sure LoadLibrary("path/to/bcrypt_lib.node") is failing but apparently it doesn't set the GetLastError() return value to something useful.

medikoo commented 11 years ago

I'll try next week with Node v0.10.1 and bcrypt v0.7.5 and let you know if anything changed.

@piscisaureus If in any way I can provide more specific logs to you, let me know, and I'll do my best.

rstich commented 11 years ago

Hi,

i have exactly the same problem here, the difference is i'm not using Windows 8 i'm using Windows 7 (x64).

ncb000gt commented 11 years ago

@medikoo Were you able to try with the latest versions?

medikoo commented 11 years ago

@ncb000gt it's on machine of one of my colleagues. I've already contacted him, I'll do my best to provide some feedback tomorrow.

Anyway whatever the error cause, it'll be great if error message would be fixed on Node's side. Lack of any information in that is the main cause of why we're just guessing (I've also opened the issue for that)

medikoo commented 11 years ago

We've tried Today, on same Windows 8 machine, bcrypt v0.7.5 and Node v0.10.3 and still there's Error: no error issue.

I'll be happy to provide more feedback, just let us know what you need.

CodyAsThePirate commented 11 years ago

It is not a node problem nor an bcrypt. There is still something missing i guess. I had the same problem on trying to run a node project on Windows 7, but 32bit. The problem was caused by a missing dependency for node-gyp, which in turn is a dependency of bcrypt. https://github.com/ncb000gt/node.bcrypt.js/#dependencies --> https://github.com/TooTallNate/node-gyp/#installation There they say: "For 64-bit builds of node and native modules you will also need the Windows 7 64-bit SDK" http://www.microsoft.com/en-us/download/details.aspx?id=8279 So i installed it, and now it works :) Hope it will solve your problem as well

TeeTeeHaa commented 11 years ago

bcrypt is a native module which must be compiled, which requires the OpenSSL SDK during compilation and which requires some OpenSSL library files during runtime. On Linux that usually is no problem, on Windows that usually is a mess.

Regarding Windows: Find the correct version of the file "libeay32.dll" (from the OpenSSL SDK you compiled brcrypt with) and copy it right next to the file "bcrypt_lib.node". It should be located in "node_modules\bcrypt\build\Release".

Alternatively make sure that "libeay32.dll" is somewhere where Windows is automatically looking for DLL files. As far as I remember the OpenSSL SDK installer for Windows from http://slproweb.com/ has an option during installation to set the %PATH% correctly.

rbraband commented 11 years ago

Thank you, thats work for me :)

Best

ncb000gt commented 11 years ago

@medikoo Have you been able to try it after following the advice of @CodyAsThePirate and/or @TeeTeeHaa?

defunctzombie commented 11 years ago

It seems like an environment or other windows related nonsense going on. Given there is no action on our part (based on what I have read) I a closing the issue.

TeeTeeHaa commented 11 years ago

It probably would save some Windows users of bcrypt.js the same troubles if the "Dependencies" section of the "README.md" says something like the following:

Make sure that Windows finds the appropriate DLL file during runtime of bcrypt.js: Either add C:\OpenSSL-Win32 to the PATH variable or copy the file "libeay32.dll" from the OpenSSL SDK brcrypt.js was compiled with with right next to the file "bcrypt_lib.node" located in "node_modules\bcrypt\build\Release".

coldice commented 11 years ago

I'm having exactly the same problem, and unfortunately I was unable to resolve it with the given solutions. I'm running on Windows 7 64 bit. Im trying to compile bcrypt 0.7.5 with node 0.10.2 and node-gyp 0.9.3. I was able to compile bcrypt with multiple different setups, however I cannot get it running, as its always throwing "error: no error". I have installed:

MSVS 2008 (Prof), 2010 (Express), 2012 (Express) Windows SDK 6.0A, Windows SDK 7.1 Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1 (KB2519277)

Python 2.7.3 OpenSSL "Win32OpenSSL-1_0_1e" with setting up PATH (is this the correct version?)

So I tried to compile with VS 2008, 2010 and 2012, which all ran fine after installing openssl with proper path settings. I can only see those warnings as shown in the first screens, about v8::Persistent::New not defined. After I installed VS 2012, I was only able to compile with the msvs_version=2012 flag, otherwise it throws:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(514,5): error MSB8008: Specified platform toolset (v110) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected.

I also checked the header machine type, they are all 64bit. Is there anything else I could check on the toolchain or on the module startup? I have not compiled node, so I cannot set breakpoints as suggested before, but if there's no other way I'll try that. Also, I have to mention, as I'm running on Windows, the whole installation might have gotten corrupt somehow, as the whole toolchain is crippled with setup bugs (deinstall this to install that, afterwards install this..)

danschumann commented 10 years ago

https://code.google.com/p/openssl-for-windows/downloads/detail?name=openssl-0.9.8k_X64.zip

Theres 64 bit openssl. Copy the include folder to Visual studio include, like C:\program files\visual studio 6\vc\include

Then extract all to C:\OpenSSL-Win64

That's what finally worked for me