我将bcrypt安装到package.json几乎没有问题

时间:2019-12-09 18:22:34

标签: javascript express npm bcrypt


我已经开始了我的项目,已经开始安装软件包,但是突然我收到一个错误,当我尝试安装bcrypt时出现了该错误。


  1. 首先,我尝试安装bcrypt。

    npm install bcrypt
    
  2. 我遇到一个错误。

    > bcrypt@3.0.7 install C:\Users\Abdulsalam\application\clothes_store\node_modules\bcrypt
    > node-pre-gyp install --fallback-to-build
    
    node-pre-gyp WARN Using needle for node-pre-gyp https download 
    node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases   /download/v3.0.7/bcrypt_lib-v3.0.7-node-v64-win32-x64-unknown.tar.gz 
    node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.7 and node@10.15.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
    gyp ERR! configure error 
    gyp ERR! stack Error: Command failed: C:\Users\Abdulsalam\AppData\Local\Programs\Python\Python36\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
    gyp ERR! stack   File "<string>", line 1
    gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
    gyp ERR! stack                                ^
    gyp ERR! stack SyntaxError: invalid syntax
    gyp ERR! stack 
    gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
    gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
    gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
    gyp ERR! System Windows_NT 10.0.18362
    gyp ERR! command "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=C:\\Users\\Abdulsalam\\application\\clothes_store\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\Users\\Abdulsalam\\application\\clothes_store\\node_modules\\bcrypt\\lib\\binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
    gyp ERR! cwd C:\Users\Abdulsalam\application\clothes_store\node_modules\bcrypt
    gyp ERR! node -v v10.15.3
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok 
    node-pre-gyp ERR! build error 
    node-pre-gyp ERR! stack 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=C:\Users\Abdulsalam\application\clothes_store\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Abdulsalam\application\clothes_store\node_modules\bcrypt\lib\binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
    node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Abdulsalam\application\clothes_store\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
    node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
    node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
    node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
    node-pre-gyp ERR! System Windows_NT 10.0.18362
    node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Abdulsalam\\application\\clothes_store\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd C:\Users\Abdulsalam\application\clothes_store\node_modules\bcrypt
    node-pre-gyp ERR! node -v v10.15.3
    node-pre-gyp ERR! node-pre-gyp -v v0.13.0
    node-pre-gyp ERR! not ok 
    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=C:\Users\Abdulsalam\application\clothes_store\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Abdulsalam\application\clothes_store\node_modules    \bcrypt\lib\binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
    npm WARN clothes_store@1.0.0 No description
    npm WARN clothes_store@1.0.0 No repository field.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted        {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! bcrypt@3.0.7 install: `node-pre-gyp install --fallback-to-build`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the bcrypt@3.0.7 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\Abdulsalam\AppData\Roaming\npm-cache\_logs\2019-12-09T18_07_53_927Z-debug.log
    

抱歉,这是一个很长的错误,但是我希望有人能帮助我,因为我必须非常快地完成此项目 而且我还没有开始。

2 个答案:

答案 0 :(得分:1)

如果您使用的是Windows,则需要通过以下方式使用bcryptjs:

npm install --save bcryptjs

答案 1 :(得分:0)

您遇到了bcrypt软件包中描述的一些错误。建议您转到their npm page并仔细阅读说明。

他们有一段描述:

如果您遇到这样的错误:

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-v48-linux-x64.tar.gz

确保已为平台安装并配置了适当的依赖项。您可以在this page中找到某些常见平台的依赖项的安装说明。

所以我只建议您转到他们的页面并按照说明进行操作。