node.bcrypt.js: npm install bcrypt@3.0.6 fails with node 12.3.0

node --version: v12.3.0 Ubuntu 18.04

In file included from ../node_modules/nan/nan.h:53:0,
                 from ../src/bcrypt_node.cc:1:
/home/cliff/.node-gyp/12.3.0/include/node/node.h:107:12: fatal error: util-inl.h: No such file or directory
 #  include <util-inl.h>
            ^~~~~~~~~~~~
compilation terminated.

Confirmed that it installs fine in mode v12.2.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 16

Commits related to this issue

Most upvoted comments

@YasharF you’re right, i was trying to install npm in v12.8.1 and nothing worked. Switched to v11.15.0 and all good

@robertIsaac you upgraded to Node 12, which is too early in its lifecycle. bcrypt is not NodeJS code, it is in C and needs to be compiled into binaries so NodeJS can load it. The compilation is specific to the version of NodeJS. This is the case as one of the 536 node modules on npm that require a similar compilation and node-pre-gyp is the compiling bridge for each one. With the upcoming releases of bcrypt precompiled binaries for NodeJS 12 will be added for some OS/Architectures. If you are going to do development in general though, you should really add the build tools to avoid running into issues with many of the other packages out there as well.

@robertIsaac make sure to run npm rebuild or reinstall your dependancies after upgrading. If the problem persists and is identical to the one listed above, double check that you have 12.3.1 installed. It’s very unlikely that you would receive this exact error on v12.3.1 because the file in question does in fact exist. If the error is different, then you’re probably experiencing a different issue.

For me, bcrypt installs and works correctly on Mac and docker containers running v12.3.1. This issue can probably be closed.