node.jsnpmbcryptmosh

bcrypt not installing when tried to using npm i bcrypt


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

I have tried to install it using npm install bcrypt but still getting the issue

npm i bcrypt

enter image description here


Solution

  • It is trying to build bcrypt from source, but you don't have the necessary tools installed for it to do so.

    Try installing the Visual C++ Build Tools first, which can be done using the following convenience npm package:

    npm install -g windows-build-tools
    

    Once that is complete, run npm install bcrypt again.

    More info here: https://www.npmjs.com/package/windows-build-tools