7

I followed this solution:

bcrypt is breaking my meteor application, how do I fix it?

But Im still getting this error:

    /home/kaleobox/bundle/programs/server/node_modules/fibers/future.js:245
                                                    throw(ex);
                                                          ^
    Error: /home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at bindings (/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
        at Object.<anonymous> (/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/bcrypt.js:3:35)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)

I went into /home/kaleobox/bundle/programs/server/node_modules and did:

rm -R /home/kaleobox/bundle/programs/server/node_modules/bcrypt

then

npm install bcrypt

but the error above persists. The line

/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header

tells me I may have to remove and reinstall bcrypt in that second location?

Community
  • 1
  • 1
redress
  • 1,399
  • 4
  • 20
  • 34

4 Answers4

4

You should reinstall bcrypt from

/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node-modules

instead of

/home/kaleobox/bundle/programs/server/node_modules

Lingxiao Sun
  • 111
  • 7
  • 1
    Thank you for posting an answer to this question! Code-only answers are discouraged on Stack Overflow, because it can be difficult for the original poster (or future readers) to understand the logic behind them. Please, edit your question and include an explanation of your code so that others can benefit from your answer. Thanks! – Maximillian Laumeister Oct 01 '15 at 21:01
  • How does one use your suggestion through npm? – jjm340 Jun 26 '17 at 02:45
1

I have solved this problem by re-installing the bcrypt package in the below directory:

  • Access to this directory:

    /my_app/programs/server/npm/npm-bcrypt/

  • Then run npm install bcrypt

  • Start your app again. It should be fine. :)

0

As @lingxiao-sun's answer indicates, you may find that copying the bcrypt in /home/kaleobox/bundle/programs/server/node_modules into /home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node-modules will fix this issue.

This is possibly because the bcrypt in <your project>/bundle/programs/server/node_modules will have been built/installed locally to the host machine, whereas the bcrypt in /server/npm/npm-bcrypt/node-modules/ will likely be from a source/build machine, and if these environments differ it can cause issues due to the specific binaries required for each environment.

Darren Shewry
  • 10,179
  • 4
  • 50
  • 46
0

The problem is you committed your bcrypt executable which was in Windows architecture, but Heroku virtual environments are Linux.

Add node_modules to your .gitignore and use git rm -r --cached node_modules.

The command will remove node_modules from your Git repository and, in your next push, changes to node_modules will be ignored.

Chance Snow
  • 2,440
  • 1
  • 18
  • 19