Node.bcrypt.js: Module not found: Error: Can't resolve 'aws-sdk' in

Created on 29 Sep 2019  路  8Comments  路  Source: kelektiv/node.bcrypt.js

  • What went wrong?
    bcrypt uses node-pre-gyp which wants to use aws-sdk which is not installed which then webpack cannot resolve.

I am not excluding the node_modules from the packed build so as to ensure easier and pain free CI/D.

  • What did you expect to happen?
    webpack build the packed file without complaint

  • Which version of nodejs and OS?
    LinuxMint 18lts
    Node 10 lts

ERROR in ./node_modules/node-pre-gyp/lib/unpublish.js
Module not found: Error: Can't resolve 'aws-sdk' in '/home/xyz/backend/ms_authentication/node_modules/node-pre-gyp/lib'
 @ ./node_modules/node-pre-gyp/lib/unpublish.js 16:14-32
 @ ./node_modules/node-pre-gyp/lib sync ^\.\/.*$
 @ ./node_modules/node-pre-gyp/lib/node-pre-gyp.js
 @ ./node_modules/bcrypt/bcrypt.js
 @ ./build/src/services/PasswordSaltedHash.js

Most helpful comment

I solved it by using bcryptjs
It is working in the browser

All 8 comments

the same error node 12

This is a workaround which then creates another problem.

Instead of being left with a single file you are left with 1 packed file and a node_modules folder which is then a pain to deploy, much easier to ship a single 3-5mb file than 1 file plus 60-100mb+ node_modules folder :/

Also seeing the same issue here.

+1

same here

I solved it by using bcryptjs
It is working in the browser

So far @proficiat 's answer worked for me. Apparently bycryptjs works just as well bcrypt but eliminates the problem I had with "aws-sdk". You do not have to change any code. Simply run an npm install bcryptjs --save and change where you have var bycrypt = require("bycrypt") to var bcrypt = require("bycryptjs"). From my experince they have the same exact functions just somehow works better than regular bycrypt.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olsnacky picture olsnacky  路  4Comments

alanosman picture alanosman  路  3Comments

jferrettiboke picture jferrettiboke  路  4Comments

japita-se picture japita-se  路  4Comments

targos picture targos  路  4Comments