First-time poster and super new to coding. Appologies if I got any of the formatting/structure wrong.
I'm using WSL on Windows 10. This is the error I'm getting when running bundle install
current directory:
/mnt/c/Windows/System32/launch_school/another_book_viewer/vendor/bundle/ruby/2.7.0/gems/nio4r-2.5.4/ext/nio4r
/usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20210205-385-1b9hve3.rb extconf.rb
checking for unistd.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
/usr/lib/ruby/2.7.0/mkmf.rb:471:in 'try_do': The compiler failed to generate an executable file.(RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.7.0/mkmf.rb:613:in 'try_cpp'
from /usr/lib/ruby/2.7.0/mkmf.rb:1124:in 'block in have_header'
from /usr/lib/ruby/2.7.0/mkmf.rb:971:in 'block in checking_for'
from /usr/lib/ruby/2.7.0/mkmf.rb:361:in 'block (2 levels) in postpone'
from /usr/lib/ruby/2.7.0/mkmf.rb:331:in 'open'
from /usr/lib/ruby/2.7.0/mkmf.rb:361:in 'block in postpone'
from /usr/lib/ruby/2.7.0/mkmf.rb:331:in 'open'
from /usr/lib/ruby/2.7.0/mkmf.rb:357:in 'postpone'
from /usr/lib/ruby/2.7.0/mkmf.rb:970:in 'checking_for'
from /usr/lib/ruby/2.7.0/mkmf.rb:1123:in 'have_header'
from extconf.rb:15:in 'main'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/mnt/c/Windows/System32/launch_school/another_book_viewer/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/mnt/c/Windows/System32/launch_school/another_book_viewer/vendor/bundle/ruby/2.7.0/gems/nio4r-2.5.4 for inspection.
Results logged to
/mnt/c/Windows/System32/launch_school/another_book_viewer/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/nio4r-2.5.4/gem_make.out
An error occurred while installing nio4r (2.5.4), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.5.4' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
puma was resolved to 5.2.0, which depends on<br>
nio4r
Here are the contents of the mkmf.log file:
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.7.0 -I/usr/include/ruby-2.7.0/ruby/backward -I/usr/include/ruby-2.7.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/ruby2.7-W7xcA4/ruby2.7-2.7.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -lruby-2.7 -lm -lc"<br>
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
When I try to run gem install nio4r -v 2.5.4
I get this error:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.7.0 directory.
Is my issue because I don't have permissions to write to the directory? If so, how can I give myself permissions?
Thanks for reading.
question from:
https://stackoverflow.com/questions/66057333/need-help-installing-ruby-gem-nio4r 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…