使用Ruby创建Shopify应用程序



这是我第一次用Ruby创建Shopify应用程序,所以我有几个问题,我试图使用以下命令安装:

bundle install

但我得到了这个错误:

[!] There was an error parsing `Gemfile`: 
[!] There was an error while loading `my_app.gemspec`: cannot load such file -- my_app/version
Does it try to require a relative path? That's been removed in Ruby 1.9. Bundler cannot continue.
#  from /var/www/html/shopify_app/my_app.gemspec:2
#  -------------------------------------------
#  $LOAD_PATH.push File.expand_path('../lib', __FILE__)
>  require "my_app/version"
#  
#  -------------------------------------------
. Bundler cannot continue.

这就是我已经拥有的:

my_app.gemspec

$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require "my_app/version"
Gem::Specification.new do |s|
s.name        = "my_app"
s.version     = ShopifyApp::VERSION
s.platform    = Gem::Platform::RUBY
s.author      = "Shopify"
s.summary     = %q{This gem is used to get quickly started with the Shopify API}
s.required_ruby_version = ">= 2.3.1"
s.add_runtime_dependency('rails', '>= 5.0.0')
s.add_runtime_dependency('shopify_api', '>= 4.3.5')
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 1.2.0')
s.add_development_dependency('rake')
s.add_development_dependency('byebug')
s.add_development_dependency('sqlite3')
s.add_development_dependency('minitest')
s.add_development_dependency('mocha')
s.files         = `git ls-files`.split("n").reject { |f| f.match(%r{^(test|example)/}) }
s.test_files    = `git ls-files -- {test}/*`.split("n")
s.require_paths = ["lib"]
end

有什么建议吗?

由于其他错误,您需要在my_app目录下添加一个version.rb文件:

[!] There was an error while loading `my_app.gemspec`: cannot load such file -- my_app/version

最新更新