N
N
narem2019-09-09 09:06:32
Node.js
narem, 2019-09-09 09:06:32

How to install bcrypt?

I'm trying to install npm install bcrypt --save in open server, I get an error

npm WARN deprecated [email protected]: bcrypt < v2.0.0 is susceptible to bcrypt wrap-around bug. Upgrade to bcrypt >= v2.0.0 for improved support for newer bcrypt hashes

> [email protected] install W:\domains\login\node_modules\bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v72-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v72-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI) (falling back to source compile with node-gyp)
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if the py launcher can be used to find Python 2
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python 2.7.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stackgyp Error: Could not find any Python installation to use
gyp  ERR!ERR!  stackfind Python     at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:303:47)

gypgyp  ERR! ERR! stackfind Python     at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:132:21)
 Python is not set from command line or npm configuration
gypgyp  ERR!ERR!  stackfind Python     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:221:16)
 Python is not set from environment variable PYTHON
gypgyp  ERR!ERR!  stack     at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:267:16)
find Python checking if "python" can be used
gyp gypERR!  ERR!stack      at exithandler (child_process.js:302:5)
find Pythongyp - "python" is not in PATH or produced an error
 gypERR!  ERR!stack      at ChildProcess.errorhandler (child_process.js:314:5)
find Pythongyp checking if "python2" can be used
 gypERR!  ERR!stack      at ChildProcess.emit (events.js:203:13)
find Pythongyp - "python2" is not in PATH or produced an error
 gypERR!  stackERR!     at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
 gypfind Python  checking if the py launcher can be used to find Python 2
ERR!gyp  stackERR!     at onErrorNT (internal/child_process.js:456:16)
 gypfind Python  - "py.exe" is not in PATH or produced an error
ERR!gyp  stackERR!     at processTicksAndRejections (internal/process/task_queues.js:77:11)
 find Python checking if Python is C:\Python27\python.exe
gyp gyp ERR! ERR! System Windows_NT 10.0.18362
find Python - "C:\Python27\python.exe" could not be run
gypgyp  ERR!ERR!  commandfind Python "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=W:\\domains\\login\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=W:\\domains\\login\\node_modules\\bcrypt\\lib\\binding"
 checking if Python is C:\Python37\python.exe
gypgyp  ERR!ERR!  cwdfind Python W:\domains\login\node_modules\bcrypt
 - "C:\Python37\python.exe" could not be run
gypgyp  ERR!ERR!  node -vfind Python v12.8.0

gypgyp  ERR!ERR!  node-gyp -vfind Python v5.0.3
 **********************************************************
gypgyp  ERR!ERR!  not okfind Python
 You need to install the latest version of Python 2.7.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gypnode-pre-gyp  ERR!ERR!  find Pythonbuild error - Set the npm configuration variable python:

gyp ERR!node-pre-gyp  find PythonERR!   npm config set python "C:\Path\To\python.exe"
 gypstack  Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=W:\domains\login\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=W:\domains\login\node_modules\bcrypt\lib\binding' (1)
ERR!node-pre-gyp  find PythonERR! For more information consult the documentation at:
 gypstack      at ChildProcess.<anonymous> (W:\domains\login\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
ERR!node-pre-gyp  find PythonERR! https://github.com/nodejs/node-gyp#installation
 gypstack      at ChildProcess.emit (events.js:203:13)
ERR!node-pre-gyp  find PythonERR! **********************************************************
 gypstack      at maybeClose (internal/child_process.js:1021:16)
ERR!node-pre-gyp  find PythonERR!
 stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gypgyp  ERR!ERR!  Systemconfigure error Windows_NT 10.0.18362

node-pre-gyp gyp ERR! ERR! command "C:\\Program Files\\nodejs\\node.exe" "W:\\domains\\login\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
stack Error: Could not find any Python installation to use
node-pre-gyp gyp ERR! ERR! cwd W:\domains\login\node_modules\bcrypt
stack     at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:303:47)
node-pre-gyp gyp ERR! ERR! node -v v12.8.0
stack     at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:132:21)
node-pre-gyp gyp ERR! ERR! node-pre-gyp -v v0.6.32
stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:221:16)
node-pre-gypgyp  ERR!ERR!  not okstack
     at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:267:16)
gyp ERR!Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=W:\domains\login\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=W:\domains\login\node_modules\bcrypt\lib\binding' (1)
 stack     at exithandler (child_process.js:302:5)
gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:314:5)
gyp ERR! stack     at ChildProcess.emit (events.js:203:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Goryachev_UA\AppData\Roaming\npm-cache\_logs\2019-09-09T06_00_39_998Z-debug.log

How to fix?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Kondratsky, 2019-09-09
@kondrackii

There hemorrhagic with python. Try bcryptjs

Y
Yuri_Antishev, 2019-09-24
@Yuri_Antishev

Faced the same problem:
1. First I tried to follow the instructions for Windows 10 from here:
Instructions for Windows
Opened powershell as administrator and entered the command
I waited for the complete installation - you should see All done
But the error remained ...
2. Then I decided to completely remove node.js and installed the latest version at the moment.
Installed with all dependencies. This helped resolve the issue.
After that, bcrypt installed successfully in node_modules.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question