kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.48k stars 515 forks source link

Module not found: Error: Can't resolve 'aws-sdk' in #758

Closed j-d-carmichael closed 4 years ago

j-d-carmichael commented 5 years ago

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

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
memosize commented 5 years ago

the same error node 12

YasharF commented 5 years ago

Try https://github.com/liady/webpack-node-externals

j-d-carmichael commented 5 years ago

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 :/

MikesBarto commented 4 years ago

Also seeing the same issue here.

proficiat commented 4 years ago

+1

vincentreynaud commented 4 years ago

same here

proficiat commented 4 years ago

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

mrlopez116 commented 4 years ago

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.