b $ b
不幸的是,我们不支持在我们的堆栈中安装额外的库或二进制文件。最好的解决方法是将这些供应商供应到您的项目中。您需要使用64位Linux版本才能在Heroku上运行;静态编译还可以帮助确保包含所需的任何依赖项。同样,对于依赖于外部库的宝石,我们建议静态编译gem并将其销售到您的项目中。
如果您希望尝试供应二进制库,或者宝石,你可以使用Heroku作为你的构建环境。我们的一位工程师创建了一个构建服务器,允许您上传源代码,运行编译步骤,然后下载所产生的二进制文件。你可以在这里找到这个项目:
https://github.com/heroku/vulcan
So I have my Ruby-on-rails app that i successfully released to heroku. However to populate the database I have several perl scripts that basically sync up tables on local database with a remote database.
On my development machine (on ec2) it works fine but I also have a lot of stuff i have installed on it over time.
When I try to run my scripts I get the following error (latest perl is installed by the way)
Can't locate DBI.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at copyStaff.pl line 4.
BEGIN failed--compilation aborted at copyStaff.pl line 4.
How do I install DBI module for Perl on heroku?
I tried through bash
apt-get install libdbi-perl
This gave me an output of
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.
[This might be irrelevant]
I tried to run this command
dpkg --configure -a
But it told me it requires super user privileges
su -l root -c "dpkg --configure -a"
- asked for root password and apparently I don't know the password (it's not the heroku login), no clue what it might be.
I also downloaded the file directly, but I need super user access. I also tried
$perl -MCPAN -e shell
cpan> install DBI
(this had same problem of not beng able to save the file)
I have a feeling i might be going at it completely the wrong way, but I can't figure out what I need to do to run those scripts.
解决方案
Well I got the answer from customer support, just pasting it here
Unfortunately we don't support installing additional libraries or binaries to our stacks. The best workaround is to vendor these into your project. You'll need to use 64-bit Linux versions to make them work on Heroku; compiling statically can also help ensure that any dependencies needed are included. Similarly, for gems that depend on external libraries, we recommend compiling the gem statically and vendoring it into your project.
If you do wish to try to vendor your binary, library, or gem, you can use Heroku as your build environment. One of our engineers created a build server that allows you to upload source code, run the compilation step, and then download the resulting binary. You can find this project here:
https://github.com/heroku/vulcan
这篇关于如何在Heroku机器上安装Perl的DBI模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!