Search code examples
node.jsnpmtravis-cibcrypt

npm bcrypt installation error when using travis


I am getting a very strange error when I try to run Travis on my application after installing the bcrypt library. Everything installs and runs fine when on my local machine but when I try to use travis I get an error installing bcrypt from package.json. Anyone know how to fix this?

npm ERR! Linux 4.8.12-040812-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v6.11.0/bin/node" "/home/travis/.nvm/versions/node/v6.11.0/bin/npm" "install"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /home/travis/build/SamKirkiles/Teller/Server/npm-debug.log
The command "cd $TEST_DIR && npm install && npm test" exited with 1.
Done. Your build exited with 1.

Solution

  • Do you have your Travis Node.js configuration set up for compiling native modules?

    Try adding this to your .travis.yml under the node_js setting (merge the env: bit together with any existing settings; you only need global: if you're building using a matrix e.g. testing on more than one Node version):

    env:
      global:
        - CXX=g++-4.8
    
    addons:
      apt:
        sources:
          - ubuntu-toolchain-r-test
        packages:
          - g++-4.8
    

    I extracted this from the Travis docs page linked above.

    If that doesn't work, maybe try linking to your .travis.yml here so we can see more about your build process.