Error installing bcrypt with npm

后端 未结 17 2209
别那么骄傲
别那么骄傲 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 14:47

    The accepted solution works but bcryptjs is slower than python and c++ version.

    If you still want bcrypt insted of bcryptjs working solution are command below, but they can also have problem.

    ✔️ npm install -g node-gyp
    ❌ npm install --g --production windows-build-tools
    

    In Windows the second command will try to install visual studio along with python and hence the problem arises. because we why would we want to install Visual studio and it take a lot of time. and it also hinders the installation of python. And if you forget to run those command as Administrator then they will get installed at C:\Users\User.windows-build-tools which further will not work because node will search for python in C:\ or C:\Program Files\ . Hence this commands in some case increase your complications.

    So the best idea for you is to ✔️install python manually for All Users And It is not necessary to add python to environment path. And run only the first command i.e

    ✔️ npm install -g node-gyp
    

    Now you are ready to install bcrypt

    npm install bcrypt
    
    0 讨论(0)
  • 2020-11-27 14:47

    I installed bcrypt-nodejs though it's already deprecated, and then removed it and installed bcrypt again. Like this, I Installed bcrypt successfully and it worked fine.

    yarn add bcrypt-nodejs
    yarn remove bcrypt-nodejs
    yarn add bcrypt 
    
    0 讨论(0)
  • 2020-11-27 14:48

    if any of the above fails to work, do:

    npm install node-gyp
    

    Afterwards visit the official python download site Official Python download link

    Install the latest version of python, make sure to check add python to path

    After installation, do:

    npm --save install bcrypt
    
    0 讨论(0)
  • 2020-11-27 14:48

    I had node version 12.18.3 and fixed the same by running npm i bcrypt@3.0.6

    0 讨论(0)
  • 2020-11-27 14:53

    I was facing the same issue on the server side( aws ubuntu 16.04).

    I tried deleting node_module/bcrypt by sudo rm -rf node_module/bcrypt multiple times and reinstalled it again and again by various ways but still facing the same issue.

    I checked node version with nvm and it was also showing stable (v10.11.0).

    Finally, I tried.

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    

    and it worked for me.

    0 讨论(0)
  • 2020-11-27 14:54

    for windows install the following module

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

    then try to install

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