skip to Main Content

Does anyone know why this error is occurring only on the production server and not when I run it locally?

internal/modules/cjs/loader.js:815
      return process.dlopen(module, path.toNamespacedPath(filename));
                     ^
    
    Error: /var/www/vhosts/user9568/**SITE_NAME**/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header
        at Object.Module._extensions..node (internal/modules/cjs/loader.js:815:18)
        at Module.load (internal/modules/cjs/loader.js:641:32)
        at Function.Module._load (internal/modules/cjs/loader.js:556:12)
        at Module.require (internal/modules/cjs/loader.js:681:19)
        at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
        at require (internal/modules/cjs/helpers.js:16:16)
        at Object.<anonymous> (/var/www/vhosts/user9568/**SITE_NAME**/node_modules/bcrypt/bcrypt.js:6:16)
        at Module._compile (internal/modules/cjs/loader.js:774:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
        at Module.load (internal/modules/cjs/loader.js:641:32)

The live server uses Plesk. I would appreciate any suggestions.

Also, please note that * * SITE_NAME * * is the domain name of the site, I didn’t want to include it in this post for obvious reasons.

Picture of Error

2

Answers


  1. Chosen as BEST ANSWER

    I found the answer because I installed bcrypt on a Windows machine, but the production server is running Linux meant that it didn’t have the correct files to work with.

    I fixed it by installing bcrypt on a Linux machine and then uploading it to the hosting server.


  2. Do you use Docker? If yes, this question on Stack Overflow may already give you the answer.

    TLDR: The .dockerignore file should include your node_modules folder.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search