Cannot find module 'bcrypt'

前端 未结 30 3002
轻奢々
轻奢々 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:48

    The problem could be because there is no this essential

    sudo apt-get install -y build-essential python
    

    Then agregate bcrypt with if you're using npm:

    npm install bcrypt
    npm rebuild
    

    or if you're using yarn:

    yarn add bcrypt
    yarn install
    yarn build
    
    0 讨论(0)
  • 2020-12-24 02:49

    If the problem could not solved after applying the workarounds above, you may try to update version in package.json as mentioned on [Fix bug] update bcrypt to 3.0.7

    Hope this helps.

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

    I followed some course, and for me it didn't work. My mistake was:

    var bcrypt = require('bcrypt.js'); 
    

    But when I changed it to

    var bcrypt = require('bcryptjs');
    

    It worked!

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

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

    I tried the commands below and my issue resolved.

    npm install node-gyp -g
    npm install bcrypt -g
    
    npm install bcrypt --save
    
    0 讨论(0)
  • 2020-12-24 02:53

    I can't run any npm commads. so, I download from this link https://github.com/kelektiv/node.bcrypt.js create folder bcrype and use it. Solve now.

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

    First check node-modules folder for a folder with this name bcrypt. If it exists with another name just rename it; for example bcrypt-pbkdf must be edited to bcrypt. If there isn't such a folder, do this in cmd:

    npm install node-gyp -g
    # bcrypt reqired node-pre-gyp
    npm install -g node-pre-gyp
    npm install bcrypt -g
    npm install bcrypt --save
    
    0 讨论(0)
提交回复
热议问题