javascript - 使用 bcrypt 的纯 JavaScript 实现

标签 javascript node.js meteor

您好,我正在使用 Meteor js,这很棒,但我在控制台上收到此消息。

W20161001-16:02:18.321(1)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20161001-16:02:18.322(1)? (STDERR) While this implementation will work correctly, it is known to be
W20161001-16:02:18.322(1)? (STDERR) approximately three times slower than the native implementation.
W20161001-16:02:18.322(1)? (STDERR) In order to use the native implementation instead, run
W20161001-16:02:18.323(1)? (STDERR)
W20161001-16:02:18.323(1)? (STDERR)   meteor npm install --save bcrypt
W20161001-16:02:18.323(1)? (STDERR)
W20161001-16:02:18.323(1)? (STDERR) in the root directory of your application.

我全局安装了node-gyp,从包文件中删除bcrypt并运行

meteor npm install --save bcrypt

得到这个错误

E:\Documents\Development\Projects\recipe-app\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\Documents\Development\Projects\recipe-app\node_modules\bcrypt
gyp ERR! node -v v4.6.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bcrypt"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.7 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\Documents\Development\Projects\recipe-app\npm-debug.log

不知道下一步该做什么,我真的对 meteor 很陌生。我在 Windows 10 上使用 shell。 Node v4.6.0 任何帮助都会很棒。

最佳答案

您需要安装适当的构建环境来编译 Node 插件(例如bcrypt)。这意味着安装 Python 2.7.x 和某种工具链。

您可以尝试windows-build-tools模块将尝试通过 npm 安装 Python 和最小编译器环境(或者您可以从 here 手动安装最小编译器环境),否则对于工具链部分,始终有 Visual C++ Express/Community(桌面版本)。

关于javascript - 使用 bcrypt 的纯 JavaScript 实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39808176/

相关文章:

regex - RegEx 可以与 Meteor "check"包一起使用吗?

javascript - 使用meteor webApp避免xss的最佳实践?

javascript - 将发布数据发送到远程站点并显示结果

javascript - 使用 JS 连接到 MS SQL Server

javascript - 从 Node.js Cloud Functions 添加 Firebase Firestore DB 监听器

php - Nginx 位置覆盖 Laravel 5.2 路由?

javascript - session 更改时函数中的 meteor react

javascript - ReactJS:为什么 `render`中定义的一些dom元素显示两次?

javascript - 动态生成的输入/按钮的单击事件处理程序?

javascript - onsubmit 函数未被调用