ruby-on-rails Gem::扩展::生成错误:错误:无法生成gem本机扩展,在VScode中运行捆绑程序安装时,不断收到此消息

t98cgbkg  于 2023-01-10  发布在  Ruby
关注(0)|答案(5)|浏览(188)

我试图在vscode for windows上运行捆绑安装,但每次我这样做,我都会得到同样的消息:

Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
Using bundler 2.1.4
Fetching byebug 11.1.3
Installing byebug 11.1.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
/home/chadcunn/.rbenv/versions/2.7.1/bin/ruby -I /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20200718-7409-qq2a6i.rb extconf.rb
creating Makefile

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" clean

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.so

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" install
/usr/bin/install -c -m 0755 byebug.so ./.gem.20200718-7409-z7mdim/byebug

Permission denied @ rb_file_s_rename - (./.gem.20200718-7409-z7mdim/byebug,
/home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/byebug)

Gem files will remain installed in /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3 for inspection.
Results logged to /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/gem_make.out

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.

In Gemfile:
  byebug

然后,当我尝试查看gem安装byebug是否成功时,我得到了以下响应:

Building native extensions. This could take a while...
ERROR:  Error installing byebug:
        ERROR: Failed to build gem native extension.

    current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
/home/chadcunn/.rbenv/versions/2.7.1/bin/ruby -I /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20200718-7520-jpov6j.rb extconf.rb
creating Makefile

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" clean

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.so

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" install
/usr/bin/install -c -m 0755 byebug.so ./.gem.20200718-7520-b4jxqm/byebug

Permission denied @ rb_file_s_rename - (./.gem.20200718-7520-b4jxqm/byebug, /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/byebug)

Gem files will remain installed in /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3 for inspection.
Results logged to /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/byebug-11.1.3/gem_make.out

我不是很有经验的编码或计算机,我实际上现在只是试图学习如何在这些程序内工作,但我不知道如何修复这个或做什么。
有人能帮帮我吗?

db2dz4w8

db2dz4w81#

您的系统缺少本地软件包来编译byebug等。您需要安装这个并重试。例如

apt-get update && apt-get install -y build-essential
pdkcd3nj

pdkcd3nj2#

您的系统可能缺少一些ruby依赖项。我在基于Ubuntu的系统上修复此错误的方法是如下安装ruby-dev包:

sudo apt update && sudo apt install ruby-dev

我对windows的系统不是很有把握,但我认为问题是一样的:缺少依赖项。如果需要更多帮助,此链接可能会很有用:https://www.ruby-lang.org/en/documentation/installation/

14ifxucb

14ifxucb3#

在绑定之前,请确保gem install byebug -v '11.1.3' --source 'https://rubygems.org/'成功。
因此,如果问题仍然存在,请运行gem install byebug -v '11.1.3',尝试gem install byebug而不指定版本,这样gem将搜索最新版本。
但是,如果问题仍然存在,您的rubyversion 2.7.1可能还不支持这个byebug版本,在这种情况下,尝试一个稳定的ruby版本,目前2.6.5,2.6.6,也就是说,所有的2.6.x现在都是稳定的。
运行gem install byebug成功后,再次运行bundle install
对于ruby和rails有很大帮助的是看一下official ruby web page,在那里你会看到很多链接,告诉你如何根据你的操作系统使用合适的ruby版本和rails版本。
这些东西在教程中并没有显示太多。

olqngx59

olqngx594#

运行
gem安装捆绑程序&&
宝石安装耙&&
wget -c https://github.com/wurmlab/sequenceserver/archive/1.1.0.beta12.tar.gz &&
焦油xfvz 1.1.0 β 12焦油
CD序列服务器-1.1.0 β 12 &&
npm安装-g捆绑包安装

np8igboo

np8igboo5#

我通过使用以下评论解决
sudo curl -长https://get.rvm.io| bash -s稳定-Ruby
关闭并重新打开终端,然后
rvm使用ruby-3.1.1
rvm --默认使用3.1.1
最后,
须藤宝石安装椰子

相关问题