Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在执行“rails new”时更改默认源?_Ruby On Rails_Gemfile - Fatal编程技术网

Ruby on rails 在执行“rails new”时更改默认源?

Ruby on rails 在执行“rails new”时更改默认源?,ruby-on-rails,gemfile,Ruby On Rails,Gemfile,当我使用railsnew创建新项目时,Gemfile中的源默认为https://rubygems.org. 但我需要使用另一个源,如何将该源设置为默认源,以便以后不需要手动更改Gemfile @更新: 我想更改源代码,因为默认的源代码在我的区域被阻塞了,真遗憾…,当执行railsnew时,它会在bundle安装时被卡住,超时后它会失败,并显示提示 如果我不能使用默认源,但我有另一个可用源,那么我应该如何完成项目的创建 以下是我失败后所做的: 更改文件中的源。 运行包安装 完成了吗?或者我需要其他

当我使用railsnew创建新项目时,Gemfile中的源默认为https://rubygems.org.

但我需要使用另一个源,如何将该源设置为默认源,以便以后不需要手动更改Gemfile

@更新:

我想更改源代码,因为默认的源代码在我的区域被阻塞了,真遗憾…,当执行railsnew时,它会在bundle安装时被卡住,超时后它会失败,并显示提示

如果我不能使用默认源,但我有另一个可用源,那么我应该如何完成项目的创建

以下是我失败后所做的:

更改文件中的源。 运行包安装
完成了吗?或者我需要其他步骤?

对于使用bundler&Gemfile的项目,可能的解决方案是:

gem安装绑定器 捆绑配置镜像。https://rubygems.org https://gems.ruby-china.com 为每个新项目添加更多镜像,这样就不必修改Gemfile的源代码。 如果默认镜像太慢或无法连接,将使用附加镜像。 小贴士:

如果某些程序包仍然卡住,则可能需要: 手工编辑Gemfile,使用您所在地区的最佳源代码。 e、 g:来源https://gems.ruby-china.com 然后运行bundle安装。
不可能。这是复制到应用程序的文件:这是不可能的。运行rails new-帮助查找rails new命令的可用选项。@Sevensacat我更新了问题,可以提供一些提示。