8

I am trying to install bcrypt to use it with sails js and passport on an ubuntu system but unable to install it. On running he command to install bcrypt following log is generated on the terminal:

    manav@tantraadmin:~$ npm install bcrypt
            \
            > [email protected] install /home/manav/node_modules/bcrypt
            > node-gyp rebuild

            make: Entering directory `/home/manav/node_modules/bcrypt/build'
              CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
            make: g++: Command not found
            make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 127
            make: Leaving directory `/home/manav/node_modules/bcrypt/build'
            gyp ERR! build error 
            gyp ERR! stack Error: `make` failed with exit code: 2
            gyp ERR! stack     at ChildProcess.onExit (/home/manav/.nvm/v0.10.31/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
            gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
            gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
            gyp ERR! System Linux 3.11.0-12-generic
            gyp ERR! command "node" "/home/manav/.nvm/v0.10.31/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
            gyp ERR! cwd /home/manav/node_modules/bcrypt
            gyp ERR! node -v v0.10.31
            gyp ERR! node-gyp -v v1.0.1
            gyp ERR! not ok 
            npm ERR! [email protected] install: `node-gyp rebuild`
            npm ERR! Exit status 1
            npm ERR! 
            npm ERR! Failed at the [email protected] 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!     node-gyp rebuild
            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! System Linux 3.11.0-12-generic
            npm ERR! command "/home/manav/.nvm/v0.10.31/bin/node" "/home/manav/.nvm/v0.10.31/bin/npm" "install" "bcrypt"
            npm ERR! cwd /home/manav
            npm ERR! node -v v0.10.31
            npm ERR! npm -v 1.4.23
            npm ERR! code ELIFECYCLE
            npm ERR! 
            npm ERR! Additional logging details can be found in:
            npm ERR!     /home/manav/npm-debug.log
            npm ERR! not ok code 0

Any ideas?

1
  • 1
    you simply miss compiler g++ (sudo apt-get install g++) Commented Sep 15, 2014 at 12:53

4 Answers 4

25

You need to sudo apt-get install build-essential python2.7 to install a compiler and other tools because bcrypt is an addon that needs to be compiled.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for this! I was having a heck of a time trying to install node-bcrypt with node v4.1.1, and this is what finally got it working for me.
Just sudo apt install build-essential is enough for me on Ubuntu 16.04 to get bcrypt installation working.
1

ERROR!!!!

  > [email protected] install /var/www/YOUR_PROJECT_ROOT_DIR/node_modules/bcrypt
  > node-gyp rebuild

  make: Entering directory '/var/www/pedestrian/node_modules/bcrypt/build'
    CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
    CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
    CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
    SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
    COPY Release/bcrypt_lib.node
  make: Leaving directory '/var/www/YOUR_PROJECT_ROOT_DIR/node_modules/bcrypt/build'

You can use both commands for fixing bcrypt addon issue:

sudo apt-get install build-essential python2.7

OR

sudo apt install build-essential

Comments

0

After I installed ubuntu 17.10 I had very similar errors with node-gyp. What worked for me was installing the node-gyp module apt-get install node-gyp

Comments

0

With a similar issue on Ubuntu, what worked for me was installing bcryptjs instead of bcrypt. Try it out

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.