xorbit / node-aes-gcm

AES GCM module for node.js using OpenSSL
MIT License
34 stars 16 forks source link

OpenSSL library on Windows in different default location than expecting #7

Closed eliotlandrum closed 7 years ago

eliotlandrum commented 7 years ago

While building on Windows 10, was having trouble building this package because of the requirement of the OpenSSL library (make sure to use the full package, NOT the light one). Once I realized that it needed to be installed, I saw that the latest version of OpenSSL 64-bit uses a different path by default than the build is expecting.

After instructing the installer to put OpenSSL files in C:\OpenSSL-Win64\ (instead of the default directory which I believe is C:\Program Files\OpenSSL-Win64\), the package installed correctly. Isn't there a better way to find the path that is more dynamic on the installation system?

Here is the output I was getting on trying to build without OpenSSL installed:

C:\WINDOWS\system32>npm install -g node-aes-gcm
\
> node-aes-gcm@0.1.7 install C:\Users\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm
> node-gyp rebuild

C:\Users\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm>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 )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  node-aes-gcm.cc
  win_delay_load_hook.cc
..\src\node-aes-gcm.cc(76): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [C:\Use
rs\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(80): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [C:\Use
rs\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(91): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [C
:\Users\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(150): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [C:\Us
ers\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(155): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [C:\Us
ers\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
..\src\node-aes-gcm.cc(164): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data [
C:\Users\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
LINK : fatal error LNK1181: cannot open input file 'C:\OpenSSL-Win64\lib\libeay32.lib' [C:\Users\eliot\AppData\
Roaming\npm\node_modules\node-aes-gcm\build\node_aes_gcm.vcxproj]
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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\eliot\AppData\Roaming\npm\node_modules\node-aes-gcm
gyp ERR! node -v v4.5.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "node-aes-gcm"
npm ERR! node v4.5.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! node-aes-gcm@0.1.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-aes-gcm@0.1.7 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-aes-gcm 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 information on how to open an issue for this project with:
npm ERR!     npm bugs node-aes-gcm
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls node-aes-gcm
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\WINDOWS\system32\npm-debug.log

C:\WINDOWS\system32>
xorbit commented 7 years ago

I just tried the latest installer from the page you linked on my Windows 10 system, and it defaults the install location to C:\OpenSSL-Win64, as expected by the bindings.gyp file.

Things did not work with the latest 1.1.0b version, the required library is missing. As the page mentioned, it "is quite different from previous releases". I got everything to compile with version 1.0.2j though. I'll have to look into what needs to change to make it work with 1.1.0b, but that's not what this issue is about so I'm closing it.

Not sure why it tried to install under Program Files on your system...