[英]Invalid ELF header caused by bcrypt
I followed this solution:我遵循了这个解决方案:
bcrypt is breaking my meteor application, how do I fix it? bcrypt 破坏了我的 meteor 应用程序,我该如何解决?
But Im still getting this error:但我仍然收到此错误:
/home/kaleobox/bundle/programs/server/node_modules/fibers/future.js:245
throw(ex);
^
Error: /home/kaleobox/bundle/programs/server/npm/npm-bcrypt/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 (/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
at Object.<anonymous> (/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/bcrypt.js:3:35)
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)
I went into /home/kaleobox/bundle/programs/server/node_modules
and did:我进入
/home/kaleobox/bundle/programs/server/node_modules
并做了:
rm -R /home/kaleobox/bundle/programs/server/node_modules/bcrypt
then然后
npm install bcrypt
but the error above persists.但上面的错误仍然存在。 The line
线
/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
tells me I may have to remove and reinstall bcrypt in that second location?告诉我我可能必须在第二个位置删除并重新安装 bcrypt?
You should reinstall bcrypt from 你应该重新安装bcrypt
/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node-modules
/家庭/ kaleobox /束/方案/服务器/ NPM / NPM-bcrypt /节点模块
instead of 代替
/home/kaleobox/bundle/programs/server/node_modules
/家庭/ kaleobox /包/程序/服务器/ node_modules
I have solved this problem by re-installing the bcrypt package in the below directory: 我通过在以下目录中重新安装bcrypt包解决了这个问题:
Access to this directory: 访问此目录:
/my_app/programs/server/npm/npm-bcrypt/
Then run npm install bcrypt
然后运行
npm install bcrypt
Start your app again. 再次启动您的应用。 It should be fine.
应该没问题。 :)
:)
As @lingxiao-sun's answer indicates, you may find that copying the bcrypt
in /home/kaleobox/bundle/programs/server/node_modules
into /home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node-modules
will fix this issue. 正如@ lingxiao-sun的回答所示,你可能会发现将
/home/kaleobox/bundle/programs/server/node_modules
的bcrypt
复制到/home/kaleobox/bundle/programs/server/npm/npm-bcrypt/node-modules
解决这个问题。
This is possibly because the bcrypt
in <your project>/bundle/programs/server/node_modules
will have been built/installed locally to the host machine, whereas the bcrypt
in /server/npm/npm-bcrypt/node-modules/
will likely be from a source/build machine, and if these environments differ it can cause issues due to the specific binaries required for each environment. 这可能是因为
bcrypt
在<your project>/bundle/programs/server/node_modules
将已建/在本地安装到主机,而bcrypt
中/server/npm/npm-bcrypt/node-modules/
将可能来自源/构建机器,如果这些环境不同,由于每个环境所需的特定二进制文件,它可能会导致问题。
The problem is you committed your bcrypt executable which was in Windows architecture, but Heroku virtual environments are Linux.问题是您提交了 Windows 架构中的 bcrypt 可执行文件,但 Heroku 虚拟环境是 Linux。
Add node_modules
to your .gitignore
and use git rm -r --cached node_modules
.将
node_modules
添加到您的.gitignore
并使用git rm -r --cached node_modules
。
The command will remove node_modules
from your Git repository and, in your next push, changes to node_modules
will be ignored.该命令将从您的 Git 存储库中删除
node_modules
,并且在您的下一次推送中,将忽略对node_modules
的更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.