我在一个远程服务器上,没有互联网接入。有一个Rails应用程序。尝试bundle install (所有的宝石都使用捆绑包--全包到app/vendor/cached进行缓存)
由于没有internet连接,所以我使用了--local标志(告诉bundle使用缓存的值- 链接):运行bundle install --local失败,并说:
An error occurred while installing pg (1.1.4), and Bundler cannot continue.
Make sure that "gem install pg -v '1.1.4' --source 'https://rubygems.org'" succeeds before bundling.现在缓存的创业板在app/vendor/cached/pg.1.1.4.gem的app文件夹中,它只发生在pg创业板上。
通常我使用:bundle config build.pg --with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10来解决这个问题(它基本上告诉bundle在安装pg时使用这些参数)。但那时我就可以上网了。
现在我可以使用以下命令手动安装pg:gem install --local app/vendor/cached/pg.1.1.4.gem -- --with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10注意到参数有两个部分,由--分隔
--local app/vendor/cached/pg.1.1.4.gem--with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10因此,参数的第一部分:--local app/vendor/cached/pg.1.1.4.gem
我怎样才能把它捆起来呢?在我有internet连接的工作站上,我仍然得到了这个错误,但是使用它来修复它:bundle config build.pg --with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10,它基本上告诉包在安装pg时使用这些参数。
但是现在包还需要使用本地路径吗?我想是吧?(就像gem install命令使用的那样?)它试图连接到rubygems.org
总结:如何使bundle install pg gem**?安装本地或者将前面显示的工作的gem install命令转换为bundle install命令?**
ruby 2.5.3,rails 5.2.1,bundler 1.17.3
bundle config输出
build.pg (/home/myuser/.bundle/config): "--with-pg-include=/usr/pgsql-10/include --with-pg-dir=/usr/pgsql-10"
我尝试了几个使用bundle config build.pg命令的组合,但没有成功:
发布于 2019-02-26 23:44:49
通过运行bundle config build.pg --with-pg-config=/usr/pgsql-10/bin/pg_config解决了这个问题。
https://stackoverflow.com/questions/54697675
复制相似问题