Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.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 执行sudo Bundle安装后更正Bundle权限_Ruby On Rails_Gemfile - Fatal编程技术网

Ruby on rails 执行sudo Bundle安装后更正Bundle权限

Ruby on rails 执行sudo Bundle安装后更正Bundle权限,ruby-on-rails,gemfile,Ruby On Rails,Gemfile,运行sudo bundle install后,如果没有前缀sudo,我将无法执行任何命令。例如,如果我想生成一个迁移 rails generate migration AddLastNameToCandidates last_name:string 它抛出了一个错误 Could not find rake-10.5.0 in any of the sources Run `bundle install` to install missing gems. 但是如果我跑 sudo rails

运行
sudo bundle install
后,如果没有前缀sudo,我将无法执行任何命令。例如,如果我想生成一个迁移

 rails generate migration AddLastNameToCandidates last_name:string
它抛出了一个错误

Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.
但是如果我跑

 sudo rails generate migration AddLastNameToCandidates last_name:string
迁移成功生成


如何恢复此操作并运行命令(如
bundle install
),而不必像sudo那样执行它

编辑:我一直在尝试,因为每一块宝石都在sudo域名下。我在这篇文章中找到了解决办法


现在,在没有sudo前缀的情况下,每个命令都可以完美地运行

使用Ruby环境,正如我读到的一些内容。但它只对维护相同的ruby版本或gems有帮助?…是的,安装后在shell中键入gem环境以查看gem路径:例如gem路径:-~/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0my rails安装在rvm上…是否相同?我不能对rvm执行同样的操作吗?首先从系统中删除rvm,因为它与rbenv不兼容。使用$rvm内爆删除,然后安装。如何
Sometimes we don’t get response from http://rubygems.org/. So it will show the given error.

You can use following ways for fixing this issue

    Try again for gem install using gem install rack command and run bundle update rake for updating your Gemfile.lock file.
    Delete the Gemfile.lock and again bundle install it.