Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: While executing gem ... (ArgumentError) wrong number of arguments (given 4, expected 1) #4976

Closed
LayersOfAbstraction opened this issue Oct 10, 2021 · 7 comments

Comments

@LayersOfAbstraction
Copy link

LayersOfAbstraction commented Oct 10, 2021

  • What did you do?

    I ran the command bundle update after inserting the jekyll-responsive-image plugin into my _config.yml file and the Gemfile and created the files for it in my _plugins and _includes directories.

I ran this on WSL2. Using Ruby 2.5 and Jekyll libraries installed from this link

  • What did you expect to happen?

    I expected Bundler to to be able to rebuild the application and for gem install jekyll-responsive-image to install the library for me to dynamically resize the image.

  • What happened instead?

I could not install the library.

Here's the packages it started fetching.\

Fetching gem metadata from http://rubygems.org/.......... Resolving dependencies... Using public_suffix 4.0.6 Using http_parser.rb 0.6.0 Using colorator 1.1.0 Using eventmachine 1.2.7 Using bundler 2.2.17 Using rb-fsevent 0.11.0 Using forwardable-extended 2.6.0 Fetching concurrent-ruby 1.1.9 (was 1.1.8) Using rexml 3.2.5 Using liquid 4.0.3 Fetching rouge 3.26.1 (was 3.26.0) Using mercenary 0.4.0 Fetching ffi 1.15.4 (was 1.15.0) Fetching rmagick 4.2.2 Fetching addressable 2.8.0 (was 2.7.0) Fetching wdm 0.1.1 Using safe_yaml 1.0.5 Using kramdown 2.3.1 Using em-websocket 0.5.2 Using pathutil 0.16.2 Using kramdown-parser-gfm 1.1.0 Fetching unicode-display_width 1.8.0 (was 1.7.0)

Then...
KABOOM, the balance of the universe destroyed itself. I could see this error.

Backtrace

ArgumentError: wrong number of arguments (given 4, expected 1)
  /home/jords/gems/gems/psych-4.0.1/lib/psych.rb:323:in `safe_load'
  /usr/lib/ruby/2.5.0/rubygems/safe_yaml.rb:31:in `safe_load'
  /usr/lib/ruby/2.5.0/rubygems/package.rb:496:in `block (2 levels) in read_checksums'
  /usr/lib/ruby/2.5.0/rubygems/package.rb:495:in `wrap'
  /usr/lib/ruby/2.5.0/rubygems/package.rb:495:in `block in read_checksums'
  /usr/lib/ruby/2.5.0/rubygems/package/tar_reader.rb:116:in `seek'
  /usr/lib/ruby/2.5.0/rubygems/package.rb:494:in `read_checksums'
  /usr/lib/ruby/2.5.0/rubygems/package.rb:547:in `block (2 levels) in verify'
  /usr/lib/ruby/2.5.0/rubygems/package/tar_reader.rb:29:in `new'
  /usr/lib/ruby/2.5.0/rubygems/package.rb:546:in `block in verify'
  /usr/lib/ruby/2.5.0/rubygems/package/file_source.rb:30:in `open'
  /usr/lib/ruby/2.5.0/rubygems/package/file_source.rb:30:in `with_read_io'
  /usr/lib/ruby/2.5.0/rubygems/package.rb:545:in `verify'
  /usr/lib/ruby/2.5.0/rubygems/package.rb:526:in `spec'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/rubygems_integration.rb:252:in `spec_from_gem'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/source/rubygems.rb:140:in `install'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/installer/gem_installer.rb:67:in `install'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/installer/gem_installer.rb:18:in `install_from_spec'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/worker.rb:62:in `apply_func'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/worker.rb:57:in `block in process_queue'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/worker.rb:54:in `loop'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/worker.rb:54:in `process_queue'
  /var/lib/gems/2.5.0/gems/bundler-2.2.17/lib/bundler/worker.rb:88:in `block (2 levels) in create_threads'

Environment

Bundler       2.2.17
  Platforms   ruby, x86_64-linux
Ruby          2.5.8p224 (2020-03-31 revision 67882) [x86_64-linux-gnu]
  Full Path   /usr/bin/ruby2.5
  Config Dir  /etc
RubyGems      2.7.6.2
  Gem Home    /home/jords/gems
  Gem Path    /home/jords/.gem/ruby/2.5.0:/var/lib/gems/2.5.0:/usr/lib/ruby/gems/2.5.0:/usr/share/rubygems-integration/2.5.0:/usr/share/rubygems-integration/all:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.5.0:/home/jords/gems
  User Home   /home/jords
  User Path   /home/jords/.gem/ruby/2.5.0
  Bin Dir     /home/jords/gems/bin
OpenSSL       
  Compiled    OpenSSL 1.1.1f  31 Mar 2020
  Loaded      OpenSSL 1.1.1f  31 Mar 2020
  Cert File   /usr/lib/ssl/cert.pem
  Cert Dir    /usr/lib/ssl/certs
Tools         
  Git         2.25.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler Build Metadata

Built At          2021-05-05
Git SHA           69cbd6e10e
Released Version  true

Gemfile

Gemfile

# frozen_string_literal: true

 source "http://rubygems.org"

 git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

 # gem "rails"
 gem "jekyll"
 gem "kramdown", ">= 2.3.1"
 gem "jekyll-responsive-image"
 gem 'wdm', '>= 0.1.0'

require 'em/pure_ruby'

Gemfile.lock

GEM
  remote: http://rubygems.org/
  specs:
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    colorator (1.1.0)
    concurrent-ruby (1.1.8)
    em-websocket (0.5.2)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    eventmachine (1.2.7)
    ffi (1.15.0)
    forwardable-extended (2.6.0)
    http_parser.rb (0.6.0)
    i18n (1.8.10)
      concurrent-ruby (~> 1.0)
    jekyll (4.2.0)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (~> 1.0)
      jekyll-sass-converter (~> 2.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 2.3)
      kramdown-parser-gfm (~> 1.0)
      liquid (~> 4.0)
      mercenary (~> 0.4.0)
      pathutil (~> 0.9)
      rouge (~> 3.0)
      safe_yaml (~> 1.0)
      terminal-table (~> 2.0)
    jekyll-sass-converter (2.1.0)
      sassc (> 2.0.1, < 3.0)
    jekyll-watch (2.2.1)
      listen (~> 3.0)
    kramdown (2.3.1)
      rexml
    kramdown-parser-gfm (1.1.0)
      kramdown (~> 2.0)
    liquid (4.0.3)
    listen (3.5.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    mercenary (0.4.0)
    pathutil (0.16.2)
      forwardable-extended (~> 2.6)
    public_suffix (4.0.6)
    rb-fsevent (0.11.0)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    rexml (3.2.5)
    rouge (3.26.0)
    safe_yaml (1.0.5)
    sassc (2.4.0)
      ffi (~> 1.9)
    terminal-table (2.0.0)
      unicode-display_width (~> 1.1, >= 1.1.1)
    unicode-display_width (1.7.0)

PLATFORMS
  x86_64-linux

DEPENDENCIES
  jekyll
  kramdown (>= 2.3.1)

BUNDLED WITH
   2.2.17
  • Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?

Absolutely. I tried upgrading to Ruby 2.7 in hopes that would solve the problem. But can't use it while I have that error. Also went here

And tried to uninstall psych which just gave me another error so I reinstalled psych.

Yes, couldn't find anything related to this error.

@deivid-rodriguez
Copy link
Member

Hi!

The problem is that you're using an old version of rubygems that does not support psych 4.

Uninstalling psych the way you tried should've done the trick for you, since the default version of psych in ruby 2.5 should still stay installed and should be compatible with the rubygems version you have installed. Feel free to copy the error you're getting when uninstalling so that we can help.

Alternatively you can upgrade rubygems with gem update --system, since this problem is fixed in recent versions. If this issue itself prevents gem update --system itself from succeeding, you can try upgrading manually following the instructions here: https://rubygems.org/pages/download.

Hope this helps!

@LayersOfAbstraction
Copy link
Author

LayersOfAbstraction commented Oct 12, 2021

Greetings @deivid-rodriguez ,

Thanks for your support! So I tried to update the gems. That didn't work and gave me the same error so I followed your link and updated the gem as sudo user.
$ sudo gem update --system
It returned a vague error. In short, the error message is passing the buck but it's not clear whether it wants me to report back to the OS makers (Microsoft) or the Ruby team. This was the output.

Updating rubygems-update
Fetching: rubygems-update-3.2.29.gem (100%)
Successfully installed rubygems-update-3.2.29
Parsing documentation for rubygems-update-3.2.29
Installing ri documentation for rubygems-update-3.2.29
Installing darkfish documentation for rubygems-update-3.2.29
Done installing documentation for rubygems-update after 149 seconds
Parsing documentation for rubygems-update-3.2.29
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.2.29
Traceback (most recent call last):
        3: from setup.rb:22:in `<main>'
        2: from setup.rb:22:in `require'
        1: from /var/lib/gems/2.5.0/gems/rubygems-update-3.2.29/lib/rubygems.rb:1328:in `<top (required)>'
/var/lib/gems/2.5.0/gems/rubygems-update-3.2.29/lib/rubygems.rb:1341:in `rescue in <top (required)>': uninitialized constant Gem::BasicSpecification (NameError)
Loading the rubygems/defaults/operating_system.rb file caused an error. This file is owned by your OS, not by rubygems upstream. Please find out which OS package this file belongs to and follow the guidelines from your OS to report the problem and ask for help.

Looks like I gotta turn to Microsoft here? Not sure yet on that.

Anyway I did as you suggested and Uninstalled psych. And then ran gem install jekyll-responsive-image No joy. This was the error.

Fetching: rmagick-4.2.3.gem (100%)
Building native extensions. This could take a while...
/usr/lib/ruby/2.5.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
ERROR:  Error installing jekyll-responsive-image:
        ERROR: Failed to build gem native extension.

    current directory: /home/jords/gems/gems/rmagick-4.2.3/ext/RMagick
/usr/bin/ruby2.5 -r ./siteconf20211013-2312-1eh82yd.rb extconf.rb
checking for brew... no
checking for pacman... no
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... no


ERROR: Can't install RMagick 4.2.3. Can't find pkg-config in /home/jords/gems/bin:/home/jords/.vscode-server/bin/7f6ab5485bbc008386c4386d08766667e155244e/bin:/home/jords/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Python39/Scripts/:/mnt/c/Python39/:/mnt/c/Program Files/Microsoft MPI/Bin/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/dotnet/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Azure Data Studio/bin:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/110/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files (x86)/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn/:/mnt/c/Program Files/Microsoft SQL Server/150/DTS/Binn/:/mnt/e/ThirdPartyApps/VSCode-win32-x64-Latest/bin:/mnt/c/Program Files (x86)/dotnet/:/mnt/e/ThirdPartyApps/Git/cmd:/mnt/e/ThirdPartyApps/nodejs/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Users/Jordan/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Jordan/.dotnet/tools:/mnt/c/Program Files/Azure Data Studio/bin:/mnt/c/Users/Jordan/AppData/Roaming/npm:/mnt/e/ThirdPartyApps/MarkdownMonsterPortable:/snap/bin


*** 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.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/$(RUBY_BASE_NAME)2.5

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/jords/gems/extensions/x86_64-linux/2.5.0/rmagick-4.2.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/jords/gems/gems/rmagick-4.2.3 for inspection.
Results logged to /home/jords/gems/extensions/x86_64-linux/2.5.0/rmagick-4.2.3/gem_make.out

Ok I go to that log. Forgive me, I don't use WSL2 that much or Linux CLIs for that matter. Maybe I should learn how to use it more? I'm sure if that would even solve this error. Anyway here is the mkmf.log it mentioned.

find_executable: checking for brew... -------------------- no

/usr/lib/ruby/2.5.0/mkmf.rb:1554: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
--------------------

find_executable: checking for pacman... -------------------- no

--------------------

assert_minimum_ruby_version!: checking for Ruby version >= 2.3.0... -------------------- yes

--------------------

find_executable: checking for pkg-config... -------------------- no

--------------------

ERROR: Can't install RMagick 4.2.3. Can't find pkg-config in /home/jords/gems/bin:/home/jords/.vscode-server/bin/7f6ab5485bbc008386c4386d08766667e155244e/bin:/home/jords/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Python39/Scripts/:/mnt/c/Python39/:/mnt/c/Program Files/Microsoft MPI/Bin/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/dotnet/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Azure Data Studio/bin:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/110/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files (x86)/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn/:/mnt/c/Program Files/Microsoft SQL Server/150/DTS/Binn/:/mnt/e/ThirdPartyApps/VSCode-win32-x64-Latest/bin:/mnt/c/Program Files (x86)/dotnet/:/mnt/e/ThirdPartyApps/Git/cmd:/mnt/e/ThirdPartyApps/nodejs/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Users/Jordan/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Jordan/.dotnet/tools:/mnt/c/Program Files/Azure Data Studio/bin:/mnt/c/Users/Jordan/AppData/Roaming/npm:/mnt/e/ThirdPartyApps/MarkdownMonsterPortable:/snap/bin

I googled the error in that log file and got this SO link

These fixes are making me a little anxious as they involve changing the permissions of the route folder. I'm looking for your opinion on that before I try one of these fixes, please. Should I try to back up my Ubuntu WSL instance first before I continue? Sorry for long message.

@deivid-rodriguez
Copy link
Member

deivid-rodriguez commented Oct 12, 2021

Hello @LayersOfAbstraction, sorry you're still having trouble.

Unfortunately the page I linked to was pretty misleading. The idea was that you downloaded the latest version manual, check it out into some directory, and then run ruby setup.rb from there. I didn't mean to recommend that you run gem update --system using sudo. I'm sorry for the confusion, I proposed some updates to that page so that this doesn't happen again in the future: rubygems/rubygems.org#2817.

Anyways, I believe that sudo gem update --system command failed, so you're probably ok.

Now, after uninstalling psych it seems like the original issue is gone, so that's good and confirms the culprit for the error you're reporting here. Hence, I'll close this ticket.

Regarding the new issue, it seems like RMagick needs either brew, pacman, or pkg-config installed? 🤔 Can you try sudo apt-get install pkg-config.

@LayersOfAbstraction
Copy link
Author

Hi again @deivid-rodriguez

Yeah I installed the suggested package as sudo. Then tried to install the jekyll-responsive-image library. Got a a very similar error to the one before this time it mentioned something about MagickCore saying

Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found

Ruby could not locate brew or pacman so or pig-config even if I sudo install it, so I tried to install MagickCore as pkg-config was dependent on the MagickCore package but it's like these 3 packages don't exist? Please advise where I should go from here.

@LayersOfAbstraction
Copy link
Author

Ok I've been able to gem install jekyll-responsive-image now. Thanks.

@Error-418
Copy link

Error-418 commented Nov 2, 2021

Hello @deivid-rodriguez and @LayersOfAbstraction I was butting my head up against this tonight. I'm getting Jekyll up and running on WSL2 myself and noted why gem update --system is having conniptions with WSL2 systems. WSL2 layers Linux on top of Windows, part of how it does that is it treats the Windows C: as a /mnt point. For interaction between the two, the security permissions of /mnt/c cannot be changed to chmod go-w this is causing the security check intended to prevent package spoofing to freak out that /mnt/c in the PATH is insecure and dumps out of the update effort.

I'm not certain exactly how to get around that, but pretty certain this is the pain point for this issue.

The particular message that points to this is:

Insecure world writable dir /mnt/c in PATH, mode 040777

larskanis added a commit to ged/ruby-pg that referenced this issue Jan 14, 2022
Error was:

  ERROR:  While executing gem ... (ArgumentError)
    wrong number of arguments (given 4, expected 1)
  Error: Process completed with exit code 1.

Upstream issue is:
  rubygems/rubygems#4976
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants