node.js - 无密码和 mongostore

标签 node.js git mongodb npm-install password-less

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

开始 pop ERR,并显示以下消息。

其中一条错误消息指出 node-gyp重建 我不知道。

另一条错误消息指出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! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e98b8a9b90999da9d9c7d1c7de" rel="noreferrer noopener nofollow">[email protected]</a> install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e1c1d0c070e0a3e4e50465049" rel="noreferrer noopener nofollow">[email protected]</a> 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

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

最佳答案

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

node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js. It bundles the gyp project used by the Chromium team and takes away the pain of dealing with the various differences in build platforms.

gyp 本身是 written in Python ,并且 node-gyp 包括 Python code直接地。您看到的错误来自其 configure.js file and is triggered when Python is not found .

您至少有两个选择:

  • 安装Python。

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

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

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

    Tokens are stored in a MongoDB database and are hashed and salted using bcrypt. If you have trouble installing bcrypt (esp. on Windows) you could also consider using the slower but pure-JS version of MongoStore.

关于node.js - 无密码和 mongostore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38814518/

相关文章:

node.js - 如何热模块替换我在服务器端渲染的 React、node.js 应用程序中开发的本地 npm 包,例如在 cezerin 中

git - Gitlab CE 的高内存使用率

windows - Windows 上的 Mongodb 性能

java - 我如何为数据对象创建动态模型/对象

git "Your branch and ' origin/master' have diverged"在远程 repo 的新克隆之后

java - Mongodb Java 驱动在聚合查询中的使用限制

node.js - 如何使用 sequelize 6 和 postgres 获得多少个打开的连接?

node.js - ShareDB 与其他 websocket 事件

node.js - Mongoose findOne 当数据不存在时卡住

git - Git Hook 支持的脚本语言