ruby-on-rails - Gem::Ext::BuildError: 错误: 无法构建 gem 原生扩展。在 VScode 中运行 bundler install 时不断收到此消息
问题描述
我正在尝试在 Windows 的 vscode 上运行捆绑程序安装,但每次我这样做时,我都会收到相同的消息:
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 install 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
我对编码或计算机不是很有经验,实际上我现在只是想学习如何在这些程序中工作,但我不知道如何解决这个问题或做什么。
谁能帮我?
解决方案
您的系统缺少用于编译 byebug 等的本机软件包。您需要安装它并重试。例如
apt-get update && apt-get install -y build-essential
推荐阅读
- android - 如何修复 Flutter 错误“FAILURE: Build failed with an exception.”?
- java - 找不到类 org.springframework.web.servlet.mvc.annotation.RequestMappingHandlerMapping
- awk - 将第二个和第三个替换为 。如果是 0
- javascript - A帧gltf指向相机角度
- r - 如何使用来自不同列的每条线数据点制作多线图?
- kotlin - 从一个 Android 屏幕导航到另一个屏幕时出现深层链接异常
- javascript - 我如何路由来自同一个组件的多个实例并在 vue 中保持自身状态
- flutter - 如何从另一个类而不是小部件中使用 setState()
- python - 分页和过滤不能与搜索结果 Django 一起使用
- flutter - 2021 年在 Android Studio (4.2.1) 上运行 Flutter 项目时构建失败