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
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.
Most helpful comment
I solved it by using bcryptjs
It is working in the browser