Cannot find module 'bcrypt'

前端 未结 30 2988
轻奢々
轻奢々 2020-12-24 01:54

I am getting error Cannot find module \'bcrypt\' in nodejs application

I have tried to install it using npm install bcrypt but still gett

相关标签:
30条回答
  • 2020-12-24 02:38

    Using npm install bcrypt command can't resolve the issue for me.

    finally, i fixed commands below and my issue resolved.

    npm install node-gyp -g
    # bcrypt reqired node-pre-gyp
    npm install -g node-pre-gyp
    npm install bcrypt -g
    
    npm install bcrypt --save
    

    node -v v8.16.1

    npm -v 6.4.1

    0 讨论(0)
  • 2020-12-24 02:40

    I was using bcrypt@3.0.6 and @types/bcrypt@3.0.0 with node 13.7.0 environment. I was running into error cannot find binding .../node_modules/../bindings/bcrypt_lib.node

    I ran this to resolve issue:

    • npm i -g node-gyp
    • npm i bcrypt --save

    This upgraded to bcrypt@3.0.8

    0 讨论(0)
  • 2020-12-24 02:41
    • Node Version vs Bcrypt Version
    • 0.4 <= 0.4
    • 0.6, 0.8, 0.10 >= 0.5
    • 0.11 >= 0.8
    • 4 <= 2.1.0
    • 8 >= 1.0.3
    • 10, 11 >= 3
    • 12 >= 3.0.6

    I had the same issue, after I installed the bcrypt particular version depends on your node version, it started to working.

    In my case my nodeJS version was 12.3.0 , so I installed by specifying the version " npm install bcrypt@3.0.6."

    I hope it will resolve the issue.

    0 讨论(0)
  • 2020-12-24 02:42

    It seems that bcrypt was depreciated at version 1.0.3 as it was susceptible to a wrap-around bug. NPM recommends installing version 2.0.0.

    So, if you wish to save it, just run the command:

    npm install bcrypt@2.0.0 --save
    
    0 讨论(0)
  • 2020-12-24 02:43

    First delete bcrypt module from your node modules. Then try the below steps:

    1) npm install node-gyp -g

    2) npm install bcrypt -g

    3) npm install bcrypt -save

    This will definitely resolve the issue.

    0 讨论(0)
  • 2020-12-24 02:44

    For me the issue resolved by below steps: Nothing above solved my issue, 1) rm -rf node_modules in your project directory 2) rm package-lock.json 3) just check you have your package.json file now 4) npm install

    Thats it, you will get bcrypt installed properly. Hope this helps.

    0 讨论(0)
提交回复
热议问题