neocities / neocities-ruby

The Neocities Gem - A CLI and library for using the Neocities web site API.
https://neocities.org
52 stars 14 forks source link

`uninitialized constant Gem::Command (NameError)` when building extension #35

Closed jamesgecko closed 2 years ago

jamesgecko commented 2 years ago

I get a compilation error when installing this CLI gem.

I'm using an M1 MacBook running macOS 12.2. Ruby 3.1.0p0 (installed via MacPorts).

17:01 in ~
><((o> gem install neocities --user-install
Fetching tty-screen-0.6.5.gem
Fetching unicode_utils-1.4.0.gem
Fetching unicode-display_width-1.8.0.gem
Fetching strings-ansi-0.2.0.gem
Fetching strings-0.1.8.gem
Fetching tty-color-0.4.3.gem
Fetching equatable-0.5.0.gem
Fetching pastel-0.7.2.gem
Fetching neocities-0.0.15.gem
Fetching necromancer-0.4.0.gem
Fetching tty-table-0.10.0.gem
Fetching wisper-1.6.1.gem
Fetching tty-cursor-0.4.0.gem
Fetching tty-prompt-0.12.0.gem
Fetching rake-12.3.3.gem
Fetching httpclient-2.8.3.gem
WARNING:  You don't have /Users/james/.local/share/gem/ruby/3.1.0/bin in your PATH,
          gem executables will not run.
Successfully installed tty-screen-0.6.5
Successfully installed unicode_utils-1.4.0
Successfully installed unicode-display_width-1.8.0
Successfully installed strings-ansi-0.2.0
Successfully installed strings-0.1.8
Successfully installed tty-color-0.4.3
Successfully installed equatable-0.5.0
Successfully installed pastel-0.7.2
Successfully installed necromancer-0.4.0
Successfully installed tty-table-0.10.0
Successfully installed wisper-1.6.1
Successfully installed tty-cursor-0.4.0
Successfully installed tty-prompt-0.12.0
Successfully installed rake-12.3.3
Successfully installed httpclient-2.8.3
Building native extensions. This could take a while...
ERROR:  Error installing neocities:
        ERROR: Failed to build gem native extension.

    current directory: /Users/james/.local/share/gem/ruby/3.1.0/gems/neocities-0.0.15/ext
/opt/local/bin/ruby3.1 mkrf_conf.rb
mkrf_conf.rb:4:in `<main>': uninitialized constant Gem::Command (NameError)

  Gem::Command.build_args = ARGV
     ^^^^^^^^^

rake failed, exit code 1

Gem files will remain installed in /Users/james/.local/share/gem/ruby/3.1.0/gems/neocities-0.0.15 for inspection.
Results logged to /Users/james/.local/share/gem/ruby/3.1.0/extensions/arm64-darwin-21/3.1.0/neocities-0.0.15/gem_make.out
jonchang commented 2 years ago

Try https://github.com/neocities/neocities-ruby/pull/34

EeveeEuphoria commented 2 years ago

Getting the exact same issue here on Manjaro Linux, latest version of ruby. I'm not familiar with ruby so I don't know how to utilize #34.

cellfourteen commented 2 years ago

Same on Windows 10 with "gem install neocities" and "gem install --no-document neocities". Full Ruby devkit install (tried it with 64 and 32 versions) with "gem update --system" "gem install rake". Also tried the older version of neocities down to 0.0.11

Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing neocities:
        ERROR: Failed to build gem native extension.

    current directory: E:/Ruby31/lib/ruby/gems/3.1.0/gems/neocities-0.0.15/ext
E:/Ruby31/bin/ruby.exe mkrf_conf.rb
mkrf_conf.rb:4:in `<main>': uninitialized constant Gem::Command (NameError)

  Gem::Command.build_args = ARGV
     ^^^^^^^^^

rake failed, exit code 1

Gem files will remain installed in E:/Ruby31/lib/ruby/gems/3.1.0/gems/neocities-0.0.15 for inspection.
Results logged to E:/Ruby31/lib/ruby/gems/3.1.0/extensions/x86-mingw32/3.1.0/neocities-0.0.15/gem_make.out
jamesgecko commented 2 years ago

34 does fix the problem for me. Here's a terminal session showing how to install it. I'm using GitHub CLI on macOS.

kingpanther13 commented 2 years ago

For anyone else having this issue, I spent hours trying to get the neocities CLI to work using Ruby 3.1 and kept getting this same error no matter what I tried, using #34 , using the instructions given by Jamesgecko, everything. I finally decided to do a fresh install of Ruby for version 2.7.5 with the devkit, and just simply using "gem install neocities" worked like a charm on the first try.

LarryKHite commented 2 years ago

Use Ruby 2.7.5 without any problem

kyledrake commented 2 years ago

I merged #34 which will hopefully solve this.