Cannot find module 'bcrypt'

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

    use bcryptjs instead bcrypt this is worked for me

    npm install bcryptjs --save
    
    0 讨论(0)
  • 2020-12-24 02:35

    I'm running Ubuntu 16.04 on DigitalOcean (512 MB / 1 CPU, 20 GB SSD)

    The following worked for me:

    1. Scale your droplet up to the 1 GB RAM option ($10/mo)

    2. Run each of the following commands (one at a time)

      sudo npm install node-gyp -g
      sudo apt-get install python
      sudo apt-get install make
      sudo apt-get install g++
      
    3. Then try again with:

      npm install bcrypt --save
      
    4. Scale droplet back down to the 512 MB option

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

    This worked for me:

    npm install bcryptjs
    

    Then:

    npm update
    
    0 讨论(0)
  • 2020-12-24 02:36

    Before using npm install, change the package.json file dependencies, i.e.

    "bcrypt":"0.7.6" 
    

    to

    "bcrypt":"*"
    
    0 讨论(0)
  • 2020-12-24 02:37

    The Solution is pretty basic, I've solved this Error / Bug with the following steps:

    Step 1: Uninstall the bcrypt package with this command :

    npm uninstall bcrypt

    Step 2: Then ReInstall it :

    npm install bcrypt

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

    Solution 1: lengthy method is : Install all dependencies first.

    npm install -g windows-build-tools, npm install -g node-gyp

    then, install bcrypt : npm install bcrypt

    Solution 2: easy method. No dependencies installation required.

    npm install bcryptjs

    ...You might have installed bcrypt but it seems like the installation was not successful for some reason. check the package.json file. If you cannot find bcrypt, the installtion was unsuccessful. You have to install again.

    As everyone explained, it because of lack dependencies that your installation was unsuccessful. You can checkout the required dependencies in the link: https://www.npmjs.com/package/bcrypt

    Note: To use bcrypt: var bcrypt = require('bcrypt'); .....

    to use bcryptjs. var bcrypt = require('bcryptjs');

    for reference: https://www.npmjs.com/package/bcrypt https://www.npmjs.com/package/bcryptjs

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