node.js - 在 Node js 中安装 bcrypt 时出错?每当我运行 npm install install --save?

标签 node.js npm window bcrypt

> bcrypt@3.0.0 install C:\projects\alecadApi\node_modules\bcrypt
> node-pre-gyp install --fallback-to-build

`node-pre-gyp` WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.0/bcrypt_lib-v3.0.0-node-v57-win32-x64-unknown.tar.gz
`node-pre-gyp` WARN Pre-built binaries not found for bcrypt@3.0.0 and node@8.10.0 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
`C:\projects\alecadApi\node_modules\bcrypt\build\bcrypt_lib.vcxproj(20,3)`: error MSB4019: The imported project "C:\Microsoft.Cp
p.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk
.
`gyp ERR!` build error
`gyp ERR!` stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\adity\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
`gyp ERR!` System Windows_NT 10.0.17134
`gyp ERR!` command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\adity\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\projects\\alecadApi\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\projects\\alecadApi\\node_modules\\bcrypt\\lib\\binding" "--napi_version=1" "--node_abi_napi=napi"
`gyp ERR!` cwd C:\projects\alecadApi\node_modules\bcrypt
`gyp ERR`! node -v v8.10.0
`gyp ERR!` node-gyp -v v3.6.2
`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:\Users\adity\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\projects\alecadApi\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\projects\alecadApi\node_modules\bcrypt\lib\binding --napi_version=1 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Projects\alecadApi\node_modules\bcrypt\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
`node-pre-gyp` ERR! stack     at emitTwo (events.js:126:13)
`node-pre-gyp` ERR! stack     at ChildProcess.emit (events.js:214:7)
`node-pre-gyp` ERR! stack     at maybeClose (internal/child_process.js:925:16)
`node-pre-gyp` ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
`node-pre-gyp` ERR! System Windows_NT 10.0.17134
`node-pre-gyp` ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Projects\\alecadApi\\node_modules\\bcrypt\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
`node-pre-gyp` ERR! cwd C:\projects\alecadApi\node_modules\bcrypt
`node-pre-gyp` ERR! node -v v8.10.0
`node-pre-gyp` ERR! node-pre-gyp -v v0.10.2
`node-pre-gyp` ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\adity\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\projects\alecadApi\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\projects\alecadApi\node_modules\bcrypt\lib\binding --napi_version=1 --node_abi_napi=napi' (1)
`npm WARN` alecadApi@1.0.0 No repository field.
`npm WARN` optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
`npm WARN` notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

`npm ERR!` code ELIFECYCLE
`npm ERR!` errno 1
`npm ERR!` bcrypt@3.0.0 install: `node-pre-gyp install --fallback-to-build`
`npm ERR!` Exit status 1
npm ERR!
`npm ERR!` Failed at the bcrypt@3.0.0 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\adity\AppData\Roaming\npm-cache\_logs\2018-07-07T10_51_34_631Z-debug.log```

最佳答案

你应该使用

npm install --save bcrypt

正确安装。

顺便说一句,要使用bcrypt,你需要安装python。如果你想独立于 python,请使用 bcryptjs

npm install --save bcryptjs

关于node.js - 在 Node js 中安装 bcrypt 时出错?每当我运行 npm install install --save?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51222536/

相关文章:

javascript - 来自 Node JS 中查询 SELECT Mongoose 的 JSON 解析错误

node.js - 在项目中包含自定义 Yeoman 生成器

node.js - 嵌套 js 中的错误 node_modules/jest-diff/build/diffLines.d.ts(8,13) : error TS1005: '=' expected.

python - 按下按钮pyqt5后无法打开新窗口

php - 检测窗口关闭

javascript - Node.JS deflate/gzip 响应文本

node.js - 如何将软件包与 Node 安装程序捆绑在一起?

python - Linux中使用Python获取事件窗口的进程

javascript - 如何使用 moment 将时间转换为百分比

linux - CentOS 错误 - sudo : effective uid is not 0, 是 sudo 安装 setuid root 吗?