By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I get the folowing errors when trying to run npm install with "bcrypt": "^0.8.6" as a devDependency

error bcrypt@0.8.7 install: `node-gyp rebuild`
error Exit status 1
error Failed at the bcrypt@0.8.7 install script.
error This is most likely a problem with the bcrypt package,
error not with npm itself.
error Tell the author that this fails on your system:
error     node-gyp rebuild
error You can get their info via:
error     npm owner ls bcrypt
error There is likely additional logging output above.
error System Windows_NT 10.0.10586
error command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
error cwd C:\Users\username\Documents\my-app
error node -v v4.2.4
error npm -v 1.4.3
error code ELIFECYCLE
verbose exit [ 1, true ]

Thanks!

For anyone else struggling with this:
http://stackoverflow.com/questions/29320201/error-installing-bcrypt-with-npm

I'm now using the bcrypt-nodejs library.
npm install --save bcrypt-nodejs && npm uninstall --save bcrypt

I've been using it without any issues for a while now.

nikhilshinde57, buicongdang, scheung38, EmirGluhbegovic, christ776, kapaggar, rhuankarlus, TeknoloGenie, a372210777, Darmikon, and 312 more reacted with thumbs up emoji TFiroozian, hinsencamp, KasraK2K, rmfranciacastillo, ankitasharma95, toondaey, rajkumar-mobwings, MikkyBoy357, prisar, JaLe29, and 12 more reacted with thumbs down emoji sahil5d, adammoisa, babzcraig, bersling, BMartinos, codyfyi, seanghay, yingliangzhang, luiseduardobrito, toksdotdev, and 36 more reacted with laugh emoji crishood, buicongdang, TeknoloGenie, steebchen, rodriguezsergio, silvae86, josealonsogarcia, chicklightning, leonardosarmentocastro, adammoisa, and 57 more reacted with hooray emoji buicongdang, rhuankarlus, steebchen, justsml, rodriguezsergio, AlexArendsen, silvae86, SkylinR, chicklightning, adammoisa, and 74 more reacted with heart emoji Fusseldieb, pavlea, matiasmir, bavouasoft, terryjiang1996, PickHD, salsa-project, josegustavoo, nduc999112, whitersun, and 8 more reacted with rocket emoji ihabshea, ethluz, Fusseldieb, bavouasoft, terryjiang1996, victorvarenic, nduc999112, whitersun, RaiderNationBuilder, Nits7029, and 0l1v3rr reacted with eyes emoji All reactions edwardGunawan, patryk-bernasiewicz, exapsy, MelroyNoronha, chaitanyamean, MalekBouba, LUAI-SH, codeDelights, shaz13, younes-ghorbany, and 26 more reacted with thumbs up emoji ozeydi, saymont, and JonathanCramer reacted with laugh emoji FahmyChaabane reacted with heart emoji All reactions

I had issue

https://forums.meteor.com/t/another-mup-failed-deployed-any/29277

and now this solved it for me:

$npm install --save bcrypt-nodejs && npm uninstall --save bcrypt
  silanpa, vaxo-m, sharonlucong, econi, MyrnaArredondo, yuhsin423, cabrelkemfang, laurelkarthik, suab321, arundas1903, and 19 more reacted with thumbs up emoji
  ankush066, steering-perception, ychugai, MikkyBoy357, avisk1, PowerOfM, Catvari, and zainwaseem reacted with thumbs down emoji
  econi, suab321, Fusseldieb, pavlea, jawhersghaierr, yashi32, pkasson, wispyco, Kamyil, nodesl, and 5 more reacted with heart emoji
    All reactions
  syedzubairahmed001, jonatasfernandespimenta, and dileep-cz reacted with thumbs up emoji
  discussion4all and cacheflow reacted with thumbs down emoji
  CarolinSch, zenVentzi, inimist, lightness, bbsmithy, mikelbrierly, nodedeveloper4squarelogic, aldaprojects, alxpsr, syedzubairahmed001, and 18 more reacted with laugh emoji
  Gwillison415, arpitjain099, cacheflow, CarolinSch, zenVentzi, elhakeem, bbsmithy, sergiu-oanea, and Sebastp reacted with hooray emoji
  seezee78, sergiu-oanea, ChanukaSandeepa, sostenesapollo, and PlayerNguyen reacted with heart emoji
  madgustoo, bbsmithy, sergiu-oanea, onurgundogdu75, and sostenesapollo reacted with rocket emoji
    All reactions
bcrypt fails at the install script at node-gyp rebuild
[Solved] bcrypt fails at the install script at node-gyp rebuild
      Oct 5, 2016
  nicely, itsmeguru786, rish-0-0, hawaijar, Hiranlive, GabrielMachado11, Tai13492, AdonysProg, and ChigozieL reacted with thumbs up emoji
  kipropbrian, Sabonar, and avisk1 reacted with thumbs down emoji
  seeroush, nicely, and GabrielMachado11 reacted with hooray emoji
  avisk1 reacted with confused emoji
  nicely, itsmeguru786, KenMills, Hithesh-GR, GabrielMachado11, Tai13492, and BasRizk reacted with heart emoji
    All reactions
          

on mac os following solution worked for me
Install Xcode
Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

sources https://github.com/nodejs/node-gyp/issues/569

emmya, MattHaugen, aikhan, namenyi, bar-colu, and saulcal reacted with thumbs up emoji TFiroozian reacted with thumbs down emoji All reactions

@hofman-p This happens if your machine is incorrectly setup. We have comprehensive installation instructions https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions

Please read them before opening an issue, if it is an obvious case, the issue will be closed without any information, or a link at most depending on the maintainers' mood

jor3l, azarus, Ilshidur, mciminesi, exapsy, tomdaniel-it, xavierfuentes, aardvarkk, waleCloud, Fenchurchh, and 39 more reacted with thumbs down emoji NE-SmallTown reacted with eyes emoji All reactions 1)Go to visual studio code
2)Open package.json
3)Delete bcrypt dependency from package.json
4)Now open terminal and run npm install bcrypt
5)Restart visual studio code(Always a good practice if things not working :))

asampat3090, Zaheer211, SimaAmini, zamudio-fabian, jaymesanches, gurunathsane, shehrozayazz, will-amaral, pd-ag, davidmbrister, and 17 more reacted with thumbs up emoji Nditah, aldahick, TFiroozian, nosuchip, cafca, Anon-Exploiter, AnkitChauhanDatamatics, and newerton reacted with thumbs down emoji All reactions

I don't think replacing it with another solution is a proper fix. As I understand, bcryptjs is a much slower alternative, written in plain JS. In node environment, it's a big deal, as you can use node module with proper bcrypt library.

For me, carefully following readme's helped narrow down the issue, so I tl;dr it here:

  • Check that you have make, build-essential (or gcc I guess), python installed (other packages for other OSes, like cpp redist for windows);
  • Check that correct version requested according to compatibility table in repo readme. (i.e. 3.0.6+ for node 12+).
  • After correcting packages and versions, the package was installed without any problems. Hope that helps someone who was brought here by Google like me.

    By the way, wiki page mentioned here: https://www.npmjs.com/package/bcrypt-nodejs does not exist.

    #ISSUE: Same as everyone else
    #Problem: NPM isn't installing full package requirements and so it misses key libraries for Bcrypt.
    Resolved: Our resolution after trying everything and not getting anywhere, was to use

    Yarn add bcrypt

    We also found when we ran yarn, actually a lot of our dependencies are missing key libraries.

    Our build is Node v16 & Bcrypt 5.0.1

    修正部署時的錯誤: - ServiceError - Configuration validation exception: Unknown or duplicate parameter: NodeCommand https://stackoverflow.com/questions/61782952/unknown-or-duplicate-parameter-nodecommand - Cannot find "/config/config.json" when using "npx sequelize-cli db:migrate" - Cannot find module '/var/app/current/express/models/../config/config.json' - missing script: start - Failed at the bcrypt@5.0.1 install script. kelektiv/node.bcrypt.js#432
    修正部署時的錯誤: - ServiceError - Configuration validation exception: Unknown or duplicate parameter: NodeCommand https://stackoverflow.com/questions/61782952/unknown-or-duplicate-parameter-nodecommand - Cannot find "/config/config.json" when using "npx sequelize-cli db:migrate" - Cannot find module '/var/app/current/express/models/../config/config.json' - missing script: start - Failed at the bcrypt@5.0.1 install script. kelektiv/node.bcrypt.js#432

    My solution: 1)Go to visual studio code 2)Open package.json 3)Delete bcrypt dependency from package.json 4)Now open terminal and run npm install bcrypt 5)Restart visual studio code(Always a good practice if things not working :))

    Thank you sooo much. It worked on Mac - M1 👍
    I firstly changed my node version to current stable version. Then I applied this method

    "node-gyp only works with stable/released versions of node. Since the bcrypt module uses node-gyp to build and install, you'll need a stable version of node to use bcrypt. "

    My solution: 1)Go to visual studio code 2)Open package.json 3)Delete bcrypt dependency from package.json 4)Now open terminal and run npm install bcrypt 5)Restart visual studio code(Always a good practice if things not working :))

    Thanks
    works for me

    hey community i am getting an errorr while installing the bcrypt i issue started when i switched from windows to ubuntu plz someOne help

    karan@karan-WD:~/Desktop/ReactBlog/blogAppwrite$ npm i bcrypt
    npm ERR! code 7
    npm ERR! path /home/karan/Desktop/ReactBlog/blogAppwrite/node_modules/bcrypt
    npm ERR! command failed
    npm ERR! command sh -c node-pre-gyp install --fallback-to-build

    npm ERR! A complete log of this run can be found in: /home/karan/.npm/_logs/2023-10-28T14_01_59_025Z-debug-0.log

    hey community i am getting an errorr while installing the bcrypt i issue started when i switched from windows to ubuntu plz someOne help

    karan@karan-WD:~/Desktop/ReactBlog/blogAppwrite$ npm i bcrypt npm ERR! code 7 npm ERR! path /home/karan/Desktop/ReactBlog/blogAppwrite/node_modules/bcrypt npm ERR! command failed npm ERR! command sh -c node-pre-gyp install --fallback-to-build

    npm ERR! A complete log of this run can be found in: /home/karan/.npm/_logs/2023-10-28T14_01_59_025Z-debug-0.log

    Try bcryptjs
    npm i bcryptjs

    @Karanpal97 need full logs, but likely you need Linux build tools like gcc, python and gyp installed, you can try sudo apt-get install build-essential and then npm i bcrypt again .
    If you're building for the browser - it's ok to use bcryptjs in build tools, and it's the only option if you need bcrypt tools in the browser.
    However, installing bcryptjs on node is... controversial alternative - I can't find the better words for that. It'll be slower from roughly 20% at best to hundreds or thousands times at worst, depending on your application.

    @dantaeusb I am currently facing an issue while trying to install the bcrypt module in my Node.js project on a Linux system. I have followed the suggestions provided in the GitHub issue discussion, including installing build tools with the command

    sudo apt-get update
    sudo apt-get install build-essential

    However, even after installing these tools, I am still encountering installation errors when running npm install bcrypt. Here is the error message I am receiving:

    karan@karan-WD:~/Desktop/ReactBlog/blogAppwrite$ npm i bcrypt
    npm ERR! code 7
    npm ERR! path /home/karan/Desktop/ReactBlog/blogAppwrite/node_modules/bcrypt
    npm ERR! command failed
    npm ERR! command sh -c node-pre-gyp install --fallback-to-build

    npm ERR! A complete log of this run can be found in: /home/karan/.npm/_logs/2023-10-28T14_01_59_025Z-debug-0.log

    Additional Information:

    Operating System: Ubuntu
    Node.js Version: v18.18.0
    npm Version:  10.2.1
    

    I have tried several solutions mentioned in various forums and the official documentation, but the problem persists. Could you please provide further guidance or suggest any additional steps I can take to resolve this issue?

    https://docs.google.com/document/d/1pNM6M1ex9yb-W3NbiH6pKhawTLZ6b41YUghoZo_lG_E/edit?usp=sharing
    this is the google doc link for A complete log of this run can be found in: /home/karan/.npm/_logs/2023-10-28T14_01_59_025Z-debug-0.log
    if u could help me in fetching the valuable insight for finding the error

    @Karanpal97 could you please share the contents of /home/karan/.npm/_logs/2023-10-28T14_01_59_025Z-debug-0.log? You can use gedit /home/karan/.npm/_logs/2023-10-28T14_01_59_025Z-debug-0.log on Ubuntu IIRC to open that file or just cat /home/karan/.npm/_logs/2023-10-28T14_01_59_025Z-debug-0.log. There should be a detailed explanation about the error which caused npm install to fail.

    @Karanpal97 One thing I forgot to mention is that you also would need python as mentioned here https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#ubuntu-and-derivatives---elementary-linux-mint-etc
    If it doesn't work I would suggest cleaning the cache and changing the npm version as often mentioned here: https://stackoverflow.com/questions/77169253/installing-bcrypt-using-npm-failes-with-error-code-7
    Unfortunately I don't have an environment to check out the versions you've mentioned but last time I used native packages it was relatively trouble free so it could totally be some kind of cache issue.

    @dantaeusb https://docs.google.com/document/d/1pNM6M1ex9yb-W3NbiH6pKhawTLZ6b41YUghoZo_lG_E/edit?usp=sharing
    the above google contain the complete log kindly see what is the issue

    @Karanpal97 I would assume it just tried to get the wrong package since you mentioned you moved from another environment. Node packages that use native libraries require binaries that are optimized and ready to run on your system specifically. You either download those from npm (if you use popular OS, CPU instruction set, node version developers typically supply ready to use binaries) or build on your own. Two things could go wrong: it was getting a package for the wrong environment (so npm cache clean helped) and if your environment has no packages ready - bcrypt build binaries only for stable versions - changing versions might have helped. Or if no binaries were ready, apt-get install -y build-essential python installed the required tools to build a binary on your own, and then on the next npm install it built the binary for you.

    It's something to do with the way the snap package for npm's confiment works, if you manually run it outside the sandbox, or with an fnm-provided version of node it works fine.

    Fine:

    /snap/node/7823/bin/node /snap/node/7823/bin/npm install bcrypt
    

    Not fine:

    /snap/bin/node  /snap/node/7823/bin/npm install bcrypt
    

    I'm unable to e.g. strace through snap-confine and don't care about it, so can't guess what that error 7 really means, but I'm going to guess "snap sandbox kill", despite sandboxing being off.

    For bcrypt to work, you need node-gyp as stated in the package docs.

    npm install -g node-gyp
    

    node-gyp itself requires other dependencies: make, gcc, and python. The first two you can get one-by-one or by installing build-essential:

    sudo apt-get install build-essential
    

    node-gyp works with python3, don't let bcrypt's wiki page that was referenced in this github issue a lot confuse you.

    sudo apt-get install python3
    

    And then as suggested by @dantaeusb, clean cache and, I would add, remove node modules, that last piece was crucial for my setup to finally start working:

    rm -rf node_modules
    npm cache clean --force
    npm install
    

    I get the folowing errors when trying to run npm install with "bcrypt": "^0.8.6" as a devDependency

    error bcrypt@0.8.7 install: `node-gyp rebuild`
    error Exit status 1
    error Failed at the bcrypt@0.8.7 install script.
    error This is most likely a problem with the bcrypt package,
    error not with npm itself.
    error Tell the author that this fails on your system:
    error     node-gyp rebuild
    error You can get their info via:
    error     npm owner ls bcrypt
    error There is likely additional logging output above.
    error System Windows_NT 10.0.10586
    error command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
    error cwd C:\Users\username\Documents\my-app
    error node -v v4.2.4
    error npm -v 1.4.3
    error code ELIFECYCLE
    verbose exit [ 1, true ]
    

    Thanks!

    use yarn add bcrypt