2

我为无密码示例克隆了一个 github 存储库(https://github.com/rbudiharso/smsauth-example),但是当我尝试从 package.json 进行 npm 安装时

ERR 开始弹出以下消息。

其中一条错误消息指出了node-gyp rebuild我不知道的内容。

另一个错误信息指出problem with bcrypt

我尝试安装但失败的模块是passwordless-mongostore(在npm上可用)

所以当我尝试安装node-gyp时,下面的错误日志仍然存在。

WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "/path/to/executable/python2.7", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (/home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14)
gyp ERR! stack     at /home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11
gyp ERR! stack     at F (/home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/which/which.js:70:16)
gyp ERR! stack     at E (/home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/which/which.js:82:29)
gyp ERR! stack     at /home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/which/which.js:91:16
gyp ERR! stack     at /home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack     at /home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Linux 4.2.0-c9
gyp ERR! command "/home/ubuntu/.nvm/versions/node/v4.4.5/bin/node" "/home/ubuntu/.nvm/versions/node/v4.4.5/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/workspace/node_modules/passwordless-mongostore/node_modules/bcrypt
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
npm ERR! Linux 4.2.0-c9
npm ERR! argv "/home/ubuntu/.nvm/versions/node/v4.4.5/bin/node" "/home/ubuntu/.nvm/versions/node/v4.4.5/bin/npm" "install"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
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!     /home/ubuntu/workspace/npm-debug.log

所以我只想在写完所有内容之前安装并运行该项目,有人可以帮忙吗?

4

1 回答 1

2

尽管它paswordless-mongostore是一个 NPM 模块,但它具有 Python 依赖项。它直接依赖于bcrypt,它直接和间接地依赖于node-gyp

node-gyp是一个用 Node.js 编写的跨平台命令行工具,用于为 Node.js 编译本机插件模块。它捆绑了Chromium 团队使用的gyp项目,并消除了处理构建平台中各种差异的痛苦。

gyp本身是用 Python 编写的,并且直接node-gyp包含Python 代码。您看到的错误来自其configure.js文件,并在 Python 未找到时触发

你至少有两个选择:

  • 安装 Python。

    根据您的环境,这可能从简单的单行命令到完全不可行。

  • 使用不同的库,例如passwordless-mongostore-bcrypt-node.

    自述文件包含以下passwordless-mongostore建议:

    令牌存储在 MongoDB 数据库中,并使用bcrypt进行散列和加盐处理。如果您在安装 bcrypt 时遇到问题(尤其是在 Windows 上),您还可以考虑使用速度较慢但纯 JS 版本的 MongoStore。

于 2016-08-25T21:11:26.410 回答