运行节点应用程序时,bcrypt无效的elf头 [英] bcrypt invalid elf header when running node app

查看:456
本文介绍了运行节点应用程序时,bcrypt无效的elf头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为学校设计一个nodejs项目. 我无法使用npm安装bcrypt,因此我安装了bcrypt-nodejs,并且该项目昨天运行良好. 但是今天,当我做一个节点应用程序"时,我遇到了这个错误:

I'm working on a nodejs project for school. I wasn't able to install bcrypt with npm so i installed bcrypt-nodejs and the project worked fine yesterday. But today, when I do a "node app" i have this error :

/.../node_modules/bcrypt/node_modules/bindings/bindings.js:79
        throw e
              ^
Error: /.../node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at bindings (/.../node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
    at Object.<anonymous> (/.../node_modules/bcrypt/bcrypt.js:1:97)
    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)
    at require (module.js:380:17)

我的package.json文件如下:

my package.json file looks like this:

{
  "name": "Supinfarm",
  "version": "0.0.0",
  "env": {
              "PYTHON": "/usr/bin/python2.6"
        },
  "dependencies": {
    "express": "3.1.0",
    "connect-flash": "*",
    "jade": "*",
    "stylus": "*",
    "passport": "*",
    "passport-local": "*",
    "mongoose": "*",
    "bcrypt": "*"
  }
}

我在使用Linux ubuntu 10.04 LTS 我试图在Google上找到解决方案,但没有成功... 有人可以帮我吗?

I'm on Linux ubuntu 10.04 LTS I've tried to find a solution on google without success... Can somebody help me?

推荐答案

我发现在OSX上编译的 bcrypt在Linux上无法正常运行.换句话说,如果您检入在本地OSX工作站上编译的bcrypt,并尝试在Linux服务器上运行节点应用程序,则会看到上面的错误.

I've found that bcrypt compiled on OSX will not quite work on Linux. In other words, if you check in the bcrypt compiled on your local OSX workstation, and try to run the node app on your linux servers, you will see the error above.

解决方案:npm install bcrypt在Linux上,检入,已解决.

Solution: npm install bcrypt on Linux, check that in, solved.

可能最好的解决方法是排除.gitignore ...中的node_modules,然后远程安装npm.

Probably the best way to deal with this is exclude your node_modules in .gitignore... and npm install remotely.

这篇关于运行节点应用程序时,bcrypt无效的elf头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆