I am running a rails app with docker-compose on a m1 mac.
Kept getting 2 specific errors,
/usr/local/bundle/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
This is the first one
/usr/local/bundle/gems/nokogiri-1.13.6-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative': Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by /usr/local/bundle/gems/nokogiri-1.13.6-aarch64-linux/lib/nokogiri/3.1/nokogiri.so) - /usr/local/bundle/gems/nokogiri-1.13.6-aarch64-linux/lib/nokogiri/3.1/nokogiri.so (LoadError)
This is the second one.
The errors started showing after all the gems are installed, I have reinstalled nokogiri countless times, rebuilt the image and container, and made sure bundle installs in my dockerfile as well.
This problem was resolved by adding platform: linux/x86_64 into my docker-compose.yml file
Related
I've been struggling to put together my dev environment while getting this error after I've had a clean bundle install with zero issues as well as checking that my rbenv is set up and my ruby version is set to the correct dev environment requirements. Whenever I try to boot up the rails server or console I am met with the error below.
/Users/devadmin/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.7/lib/active_support/dependencies.rb:324:in `require`: cannot load such file -- pty (LoadError)
I have tried installing rubysl-pty to no avail as well as setting up the environment from scratch multiple times still getting this error. I am currently on a Mac using Big Sur I am not really sure where to begin with this issue as pty comes supported with Ruby but I have reinstalled it and rbenv multiple times to still get this error.
Sometimes I also see this kind of errors
You should try add RAILS_ENV=development to your command line, I hope it work.
Example
RAILS_ENV=development bundle exec rails s
I recently installed Windows Subsystem for Linux and I'm running the Ubuntu distro on my Windows 10 computer. I installed Python, pip, Ruby, and Jekyll and they are all confirmed to be installed properly when I run the --version flags.
I am trying to run and modify a Jekyll theme called Mediumish locally on my computer. When following the author's instructions (i.e. run bundle and run jekyll serve --watch), I encounter the following errors:
Traceback (most recent call last):
5: from /usr/local/bin/jekyll:23:in `<main>'
4: from /usr/local/bin/jekyll:23:in `load'
3: from /var/lib/gems/2.5.0/gems/jekyll-3.8.6/exe/jekyll:11:in `<top (required)>'
2: from /var/lib/gems/2.5.0/gems/jekyll-3.8.6/lib/jekyll/plugin_manager.rb:48:in `require_from_bundler'
1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler (LoadError)
I have tried submitting issues to the author's Github account, but it appears he has stopped replying (and maintaining) this theme for a few months.
I found another Stackoverflow post titled Ruby/Jekyll unknown error when running -watch — which is very similar to what I'm experiencing. I have tried the recommended solutions from this post which are to run the jekyll build --watch and jekyll serve --watch commands, but the same errors occur.
I was able to successfully run this theme a few months ago, but after reformatting my computer, reinstalling all my applications from scratch, and cloning a new copy of the theme from the author's website, I am unable to serve the website locally thus impeding me from viewing any modifications I make to the blog theme.
I ran the gem update --system command and my Jekyll theme almost served locally.
I received the following error:
Error: could not read file /mnt/c/Users/muyga/Desktop/mediumish-theme-jekyll/vendor/bundle/gems/jekyll-3.8.5/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb: Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/gems/jekyll-3.8.5/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter. ERROR: YOUR SITE COULD NOT BE BUILT: ------------------------------------ Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/gems/jekyll-3.8.5/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.
In order to fix that error, I modified my config.yml file and added vendor to the exclude: category to exclude that folder within my theme folder.
Now when I run bundle exec jekyll serve --watch the theme serves properly.
Thanks to #JayDorsey and Jekyll: Error: Site could not be built, wrong date format
for the solutions!
I'm having a lot of trouble googling this issue, as bundler keeps coming up. However, my issue is with a c library that I've bundled using mkmf and the ruby c api. I've compiled my c code into a file (e.g. my_library.bundle) and I've required it inside a helper with require_relative "my_library" without a problem.
The problem arrises when I deploy to heroku and I get the error:
2019-08-14T19:09:15.452530+00:00 app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': cannot load such file -- /app/app/helpers/my_library (LoadError)
I can run ls and cat on my heroku app to verify the file is there and the contents match. When I run the application locally with RAILS_ENV=production, I also don't run into any issues. Also, running heroku local web runs fine on my machine.
Does this have something to do with my configs autoload_paths? My main issue is that I can't seem to debug this locally.
EDIT:
I've noticed that this problem arrises in dockerized instances, as well. It seems that something about containerization seems to be the problem. I've even tried creating a gem to contain the bundle following this guide, which works locally, but again has the same issue finding the file, but this time the path is relative to the gem, not my project. I'm still stumped on what is causing this issue.
According to the error that you posted, it seems that Docker doesn't point to the correct path cannot load such file -- /app/app/helpers/my_library. If that is correct, you should explicitly specify the working directory in your Dockerfile.
WORKDIR /path/to/project
After that, just rebuild the image.
Now, if this doesn't work, you can check autoload_paths in your project or customize bootsnap to avoid error in autoloading paths.
What you can do is have the entire my_library as a local gem and point your Gemfile to it.
Roughly, the outline would be as follows:
Place the entire code for my_library in directory within your app, say fixtures (which is at the same level as your Gemfile.)
app/
...
fixtures/
my_library/
ext/
...
lib/
...
my_library.gemspec
Rakefile
Gemfile
Point your Gemfile to the my_library gem:
gem 'my_library', path: 'fixtures/my_library'
Then simply update your Gemfile.lock by running
bundle update
As #jay-dorsey mentioned, the bundle did need to be compiled on the server that was deploying the application in order to be used. Both of the guides that I followed to create the gem had some misinformation.
The gem should contain only the source files, no compiled source files
The rakefile should reference ext.lib_dir = "lib/my_library" instead of the ext directory
The gemspec should add the rake-compiler development dependency BEFORE the other dependencies
The version files should NOT try to load the extension, as it's being used in the gemspec, which is called before the gem has a chance to be compiled by rake / bundler
.bundle files can't be read on linux machines
Trying to install Ruby alongside a Wamp Server so I can program in Rails. When I "gem install rails" in CMD, I get the following error:
C:/wamp/ruby/lib/ruby/1.9.1/rubygems/package.rb:10:in 'require': 126: The specified module could not be found. - C:/wamp/ruby/lib/ruby/1.9.1/i386-mswin32/zlib.so (Load Error)
I've checked and the zlib.so is definitely there. Where have I gone wrong?
You probably need the zlib DLL file. You can download it from here and copy it into the same folder as that zlib.so file as zlib.dll. It may be called zlib1.dll in the download, and there may already be a zlib1.dll on your machine that you need to rename to zlib.dll
Trying to get ruby on rails 1.8.7 working on windows but when i start rails server i get this error:
`require': no such file to load -- sqlite3/sqlite3_native (LoadError)
I have tried copying the 3 files and putting them in ruby/bin but it doesnt help as mentioned at the bottom of this post: http://www.ruby-forum.com/topic/216270
Any ideas?
Found the solution on this post's comments http://www.shaunambrose.com/2010/08/05/how-to-fix-a-sqlite3-dll-missing-error-message-in-ruby-on-rails/comment-page-1/#comment-15965
"The problem seems to be that the sqlite3 gem is compiled with version 3.7.3. I downloaded and set up version 3.7.3 instead and it now works just fine."
Get it here: http://www.sqlite.org/sqlitedll-3_7_3.zip
Uncomment the line “gem ‘sqlite3-ruby’, :require => ‘sqlite3′” and comment the line “gem ‘sqlite3′” in your Gemfile
While I was trying to play around Amazon Linux, I too faced the same
"/usr/local/share/ruby/gems/2.0/gems/sqlite3-1.3.10/lib/sqlite3.rb:6:in
`require': cannot load such file -- sqlite3/sqlite3_native
(LoadError)"
Since everything was already setup on my local, I tried debugging.
The issue apparently is the library is missing in
/usr/local/share/ruby/gems/2.0/gems/sqlite3-1.3.10/lib/sqlite3/
If you go to this path, you will see that sqlite3_native.so is not present.
What I did was simply, ran a locate sqlite3_native.so and copied it to the location.
I faced the same issue with all other libraries in Amazon Linux, including nokogiri and nodejs.