在捆绑之前,请确保"gem install byebug -v '11.1.3' --source 'https://rubygems.org/'"成功



我正试图在visual studio代码上安装用于ruby的byebug gem,每次我试图使用捆绑安装来安装它时,它都会给我这个错误:

Errno::EACCES: Permission denied @ rb_sysopen -
/home/ja12tk/vendor/bundle/ruby/2.7.0/gems/byebug-11.1.3/CHANGELOG.md
An error occurred while installing byebug (11.1.3), and Bundler cannot continue.
Make sure that `gem install byebug -v '11.1.3' --source 'https://rubygems.org/'` succeeds
before bundling.

这就是Gemfile所说的:

source "https://rubygems.org"
gem "byebug"
gem "rspec", "~> 3.2.0"

与Gemfile.lock 一起

GEM
remote: https://rubygems.org/
specs:
byebug (11.1.3)
diff-lcs (1.4.4)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
PLATFORMS
ruby
DEPENDENCIES
byebug
rspec (~> 3.2.0)
BUNDLED WITH
2.1.4

我甚至尝试过使用";gem安装byebug";它给了我一个错误:

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.7.0 directory.

如有任何帮助,将不胜感激

我也遇到过同样的问题,但就是这样解决的

我运行

  • sudo apt-get在根终端上安装ruby dev
  • 然后,捆绑安装在所需的Gemfile目录下

这都是

最新更新