kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.43k stars 510 forks source link

Error installing bcrypt in Linux Mint #34

Closed AlbertoElias closed 13 years ago

AlbertoElias commented 13 years ago

Hi, I needed to install mongoose-auth which needs bcrypt and I get the following error:

rm -f bcrypt_lib.node rm -Rf build node-waf configure Checking for program g++ or c++ : /usr/bin/g++ Checking for program cpp : /usr/bin/cpp Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc Checking for gcc : ok
Checking for node path : not found Checking for node prefix : ok /home/albertoelias/local Checking for function RAND_bytes : no such environment: default Traceback (most recent call last): File "/home/albertoelias/local/bin/node-waf", line 16, in Scripting.prepare(t, os.getcwd(), VERSION, wafdir) File "/home/albertoelias/local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare prepare_impl(t, cwd, ver, wafdir) File "/home/albertoelias/local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl main() File "/home/albertoelias/local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main fun(ctx) File "/home/albertoelias/local/bin/../lib/node/wafadmin/Scripting.py", line 241, in configure conf.sub_config(['']) File "/home/albertoelias/local/bin/../lib/node/wafadmin/Configure.py", line 221, in sub_config self.recurse(k, name='configure') File "/home/albertoelias/local/bin/../lib/node/wafadmin/Utils.py", line 634, in recurse f(self) File "/home/albertoelias/node_modules/bcrypt/wscript", line 29, in configure uselib_store='OPENSSL') File "/home/albertoelias/local/bin/../lib/node/wafadmin/Tools/config_c.py", line 444, in check ret = self.run_c_code(_k, _kw) File "/home/albertoelias/local/bin/../lib/node/wafadmin/Tools/config_c.py", line 521, in run_c_code o = bld(features=kw['features'], source=test_f_name, target='testprog') File "/home/albertoelias/local/bin/../lib/node/wafadmin/Build.py", line 343, in call return TaskGen.task_gen(_k, _kw) File "/home/albertoelias/local/bin/../lib/node/wafadmin/TaskGen.py", line 118, in init self.env = self.bld.env.copy() AttributeError: 'NoneType' object has no attribute 'copy' make: *\ [configure] Error 1 npm ERR! error installing bcrypt@0.3.1 Error: bcrypt@0.3.1 install: make build npm ERR! error installing bcrypt@0.3.1 sh "-c" "make build" failed with 2 npm ERR! error installing bcrypt@0.3.1 at ChildProcess. (/home/albertoelias/local/lib/node_modules/npm/lib/utils/exec.js:49:20) npm ERR! error installing bcrypt@0.3.1 at ChildProcess.emit (events.js:67:17) npm ERR! error installing bcrypt@0.3.1 at ChildProcess.onexit (child_process.js:192:12) npm ERR! bcrypt@0.3.1 install: make build npm ERR! sh "-c" "make build" failed with 2 npm ERR! npm ERR! Failed at the bcrypt@0.3.1 install script. npm ERR! This is most likely a problem with the bcrypt package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! make build npm ERR! You can get their info via: npm ERR! npm owner ls bcrypt npm ERR! There is likely additional logging output above. npm ERR! npm ERR! System Linux 2.6.38-8-generic npm ERR! command "node" "/home/albertoelias/local/bin/npm" "install" "bcrypt" npm ERR! cwd /home/albertoelias npm ERR! node -v v0.4.11 npm ERR! npm -v 1.0.27 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/albertoelias/npm-debug.log npm not ok

I've tried a lot of different things but I haven't managed to get it working...

ncb000gt commented 13 years ago

Do you have the includes for openssl?

AlbertoElias commented 13 years ago

What do you mean? I know I have openssl installed.

ncb000gt commented 13 years ago

Yes, but this is a native module that needs to be compiled. Thus it needs the header files.

AlbertoElias commented 13 years ago

I'm not quite sure I understand you. How am I supposed to solve this? I remember installing bcrypt on my mac and not getting any problem at all, but I get this strange problem with Linux Mint...

ncb000gt commented 13 years ago

I'm not familiar with Mint but if it uses apt for packages you should likely be able to install libssl-dev (depending on the repos) and shouldn't have an issue after that.

That said, if it doesn't then you'll need to figure out how to install those dev headers for openssl onto your system. MacOS has the header files already. Ubuntu did not, but sudo apt-get install libssl-dev solves that issue on Ubuntu.

If you're unfamiliar with header files then you'll want to read up on those for future reference. http://www.learncpp.com/cpp-tutorial/19-header-files/ or any other resource on google can cover it.

AlbertoElias commented 13 years ago

I already did that before installing node.js and I still get this error...

AlbertoElias commented 13 years ago

Oh, and I should add that Linux Mint is based on Ubuntu

ncb000gt commented 13 years ago

Have you verified that the headers exist where you the module is expecting them to be? Check the wscript for the locations. The reason I'm asking is because it looks like (from the configure output) that the rand_bytes function could not be found. This happens on some systems (mac i believe) but is ok? on linux it doesn't seem to be.

Another alternative from the output is that node-waf is doing something weird, but I suspect there is something up with the includes.

AlbertoElias commented 13 years ago

I decided to try removing everything related to node.js and install it again and amazingly it's working. I also checked what you mentioned, and at least this time, it's fine, so maybe it was related with that. Thanks for your help.

ncb000gt commented 13 years ago

Sure. Sorry I couldn't be of more help.