bcrypt-as-promised | Promises A version of bcrypt | REST library
kandi X-RAY | bcrypt-as-promised Summary
kandi X-RAY | bcrypt-as-promised Summary
Promises A+ version of bcrypt (exposing the `when` API)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bcrypt-as-promised
bcrypt-as-promised Key Features
bcrypt-as-promised Examples and Code Snippets
Community Discussions
Trending Discussions on bcrypt-as-promised
QUESTION
I'm working with an old code base from an old project that uses bcrypt-as-promised
(before bcrypt
allowed the use of promises). When I try and npm install
the package.json
, I receive this error for that package:
npm WARN deprecated bcrypt-as-promised@1.1.0: the bcrypt module supports promises now, this module is no longer necessary
npm WARN deprecated bcrypt@0.8.7: bcrypt < v2.0.0 is susceptible to bcrypt wrap-around bug. Upgrade to bcrypt >= v2.0.0 for improved support for newer bcrypt hashes
And then proceeds to fail (I can paste more of the error message if needed).
I'm a little confused as to how I might be able to get this now deprecated package to install. I thought about modifying the codebase to only use bcrypt
(with the now native promises supported), but I'm afraid of diving into a bee's nest and breaking the application. I was wondering first if there might be a way to install this package for the old code base to get it working.
Any thoughts? Thanks for your time and any insight you may have.
My package.json: https://github.com/twknab/mean_hike/blob/master/package.json
// Edit:
Here's the full terminal message I receive when I try and sudo npm install
:
ANSWER
Answered 2019-Jan-13 at 10:10I found a solution to my issue was to use yarn
to import all of my dependencies rather than npm
, while also swapping bcrypt-as-promised
for bcrypt
(which now includes promises with no syntax changes necessary).
I ditched
bcrypt-as-promised
and replaced it withbcrypt
in mypackage.json
file.I then changed any instance of
require('bcrypt-as-promised')
torequire('bcrypt')
(the syntax for usingbcrypt
remains the same, just the dependency importation lines need to change).Without using
yarn
, even after changing my folder permissions, I was still hitting permissions "EACCES: permission denied" errors, with onlybcrypt
failing. My versions of npm and node seemed fine. Made sure my Ubuntu box was all updated.That's when I gained the suggestion from a wise friend to try using
yarn
to grab the dependencies instead. I ranyarn import
which reads thepackage.json
file and creates ayarn.lock
file. I then installedyarn
on my ubuntu machine (sudo npm install yarn -g
), and ranyarn install
, andbcrypt
successfully installed!
It looks like if npm
dependencies were originally installed using sudo
, permission issues can be experienced when trying to install bcrypt
. My improved solution was to:
- Nuke the
./node_modules
folder viasudo rm -r ./node_modules
- Install npm packages fresh (not using
sudo
). - After this, I was able to
npm i --save bcrypt
with the package installing successfully.
Here's a link from GitHub that helped me find the solution and an excerpt:
@Mayocampo permission denied, mkdir '/home/someroute/node_modules/bcrypt/build'
It seems you run rpm as root, therrfore your account cannot
mkdir
under /home/someroute/node_modules/ Check dir withls -l /home/someroute/node_modules/
Im sure owner of upper dir is root. or your account cannot have permission.I guess there are two options are available.
sudo rm -r ./node_modules
And install package via npm again, but without using sudo.- Change mod ./node_module to access and excutable. I decided first, and its fixed
Source: juicycool92 @ GitHub
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bcrypt-as-promised
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page