@narem

Как установить bcrypt?

Пытаюсь установить npm install bcrypt --save в open server, пишет ошибку
npm WARN deprecated bcrypt@1.0.2: bcrypt < v2.0.0 is susceptible to bcrypt wrap-around bug. Upgrade to bcrypt >= v2.0.0 for improved support for newer bcrypt hashes

> bcrypt@1.0.2 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 bcrypt@1.0.2 and node@12.8.0 (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 bcrypt@1.0.2 and node@12.8.0 (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! bcrypt@1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@1.0.2 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

Как исправить?
  • Вопрос задан
  • 2295 просмотров
Пригласить эксперта
Ответы на вопрос 3
kondrackii
@kondrackii
1 + 1 = 11
Там гемор с python. Попробуй bcryptjs
Ответ написан
Комментировать
@Yuri_Antishev
Столкнулся с такой же проблемой:
1. Сначала попробовал сделать по инструкции для Windows 10 отсюда:
Инструкция для Windows
Открыл powershell от имени администратора и ввёл команду
npm install --global --production windows-build-tools

Дождался полной установки - вы должны увидеть All done
Но ошибка осталась...
2. Затем решил полностью удалить node.js и поставил самую последнюю версию на текущий момент.
Установку производил со всеми зависимостями(dependencies). Это помогло решить проблему.
После этого bcrypt успешно установился в node_modules.
Ответ написан
Комментировать
@Ludenser
Мне помогло вот это
sudo apt install build-essential
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы
23 нояб. 2024, в 00:16
2000 руб./за проект
22 нояб. 2024, в 23:55
3000 руб./за проект
22 нояб. 2024, в 22:26
3500 руб./за проект