Error: Instantiation, when executing method inside class that has no "initialize" method

Error: Instantiation, when executing method inside class that has no “initialize” method

Can you share the code? Otherwise we can only guess.

yes of couse!

require “option_parser”
require “./network”

module Block
module Cli

class Options
  @seed_ip : String
  property seed_ip = Network::TESTNET_SEED_HOST
  property host_ip : String? = nil
  property port : Int32? = nil
  property? mine = false
  property? web = false
  property? local = false
end

def self.run!(args : Array(String))
  options = Options.new

  OptionParser.parse args do |parser|
    parser.banner = "Usage: Block [arguments]"

    parser.on("-s IP", "--seed-ip=IP", "First node to connect, TestNet by default") { |i| options.seed_ip = i }
    parser.on("-i IP", "--host-ip=IP", "Node's public ip, If the node is public") { |i| options.host_ip = i }
    parser.on("-p PORT", "--port=PORT", "Node's public port, If the node is public") { |i| options.port = i.to_i }
    parser.on("-l", "--local-net", "Prevents node from connecting to public nodes") { |i| options.local = true }
    parser.on("-w", "--web", "Start web server without making the node public") { |i| options.web = true }
    parser.on("-m", "--mine", "Enable mining") { options.mine = true }

    parser.on("-h", "--help", "Show this help") do
      puts parser
      exit
    end

    parser.on("-v", "--version", "Show node version") do
      puts "Block-crystal v#{VERSION}"
      exit 0
    end
  end

  run! options
end

def self.run!(options : Options)
  blockchain = Blockchain.new

  seed_ip = options.local? ? nil : options.seed_ip
  network = Network.new seed_ip

  # Read from file system
  Storage::File.load_and_sync blockchain

  # Sync with network
  Storage::Network.load_and_sync blockchain, network

  blockchain.verbose = true

  # Start web server if enabled
  if options.web? || options.port || options.host_ip
    spawn Web.start! network, blockchain, options.port, options.host_ip
  end

  # Start miner if mining
  spawn Miner.start! blockchain if options.mine?

  sleep
end

end
end

getting this error

In src/block.cr:3:13

3 | Block::Cli.run! ARGV
^—
Error: instantiating ‘Block::Cli:Module#run!(Array(String))’

code for executing the first code.

require “./Block”

Block::Cli.run! ARGV

Can you provide a reduced example that produces the error? Ideally on https://play.crystal-lang.org/?

something similar to this: Carcin

but when executing the code is showing:

Error: instantiating ‘Block::Cli:Module#run!’

I’m sorry, but I can’t help if I’m not able to reproduce the error. Error: instantiating ‘Block::Cli:Module#run!’ isn’t really enough to go off of.

okay, thanks a lot for your time