我在nodejs应用程序中找不到模块"bcrypt"时出错

我曾try 使用npm install bcrypt安装它,但仍然遇到问题.

node app.js

Error message:

Dec 30 2015 5:22:18 PM+05:30 - info: Connected to database:  
postgres://testdb:see2@$W@localhost/testdb

Dec 30 2015 5:22:18 PM+05:30 - error: Error: Cannot find module 'bcrypt'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (D:\...\server\modules\user\model
s\user.js:11:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

推荐答案

使用npm install bcrypt命令无法解决我的问题.

我试着用下面的命令解决了这个问题.

npm install node-gyp -g
npm install bcrypt -g

npm install bcrypt --save

Node.js相关问答推荐

如何修复PayPal Node.js Webhook中Webhook签名验证失败?''

如何使用jq将依赖项添加到package.json中

如何将Node.js与Nuxt.js一起使用?

Node.js 连接在查询完成之前终止

我正在try 在公共目录中使用 Express.js 项目部署 Angular 静态构建

yarn 安装失败,因为 node-gyp 正在寻找过时的 node 版本标头

使用 Nodejs 获取 Firebase 云消息传递历史记录

如何防止 Chrome 通过 Selenium 崩溃?

Angular Build 生产返回致命的 javascript 无效大小错误

如何解决未调用 Express 错误处理程序的问题

ResponseError:键空间ks1不存在

使用 firebase 函数 api 运行套接字(相同的端口创建问题)

您如何写入 aws lambda 实例的文件系统?

file.slim.js 中的苗条是什么

如何运行用 TypeScript 编写的 Mocha 测试?

如何在 NodeJs 中下载和解压缩内存中的 zip 文件?

遍历 NodeJS 中的一系列日期

在 Jade 包含中使用变量

如何仅在丢失的路由上将 Express.js 设置为 404?

桌面应用程序仅支持 oauth_callback 值 'oob'/oauth/request_token