Error installing bcrypt with npm

后端 未结 17 2210
别那么骄傲
别那么骄傲 2020-11-27 14:20

I\'m unable to install bcrypt using npm on my machine because I encounter the following errors. I have been troubleshooting the issue without much luck. Can you

相关标签:
17条回答
  • 2020-11-27 15:04

    On this command:

    npm install --g --production windows-build-tools
    

    You may have to run this in Powershell as administrator on your Windows machine.

    You do that by right-clicking on Powershell and select "Run As Administrator"

    0 讨论(0)
  • 2020-11-27 15:05

    Reason for Error : Node maybe can’t able to find the Python path on your system

    Solution

    step: 1 Rum command prompt as administrator step 2 Install the package

      npm install --global --production windows-build-tools
    

    It may take some while, keep patient

    step 3 Now install

    npm install node-gyp
    

    Last step Now you are ready to Go

    npm install bcrypt
    
    0 讨论(0)
  • 2020-11-27 15:09

    Upgrade to bcrypt@5.0.0

    npm i bcrypt@5.0.0

    I am not getting errors on this newer version of bcrypt, older version gave different types of errors ranging from not able to install bcrypt to typescript type errors

    0 讨论(0)
  • 2020-11-27 15:11

    I just ran the following then tried the install and it worked:

    npm install node-pre-gyp -g
    
    0 讨论(0)
  • 2020-11-27 15:12

    The easy solution is just switch from the "bcrypt" npm module to bycryptjs or bcrypt-nodejs. It's the exact same API, but pure JS so no native add-ons to deal with.

    npm install --save bcryptjs && npm uninstall --save bcrypt
    

    Then change your require calls to "bcryptjs", but all your code otherwise can be unchanged.

    Long term, I suspect at the moment bcrypt may not be ready for node v0.12.0 yet, but if not it will eventually be updated and ready.

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