I am attempting to build an online store using the Shopify Gem. I have added gem shopify_api
to the Gemfile and run bundle install
and also bundle update
. However when I run the next command:
rails generate shopify_app -api_key=[API_KEY_HERE]-secret=[SECRET_KEY_HERE]
I get the following error:
Could not find generator 'shopify_app'. Maybe you meant 'scaffold', 'scss:assets' or 'controller'
Run `rails generate --help` for more options.
I have tried restarting the rails server and it had no effect. Why am I getting this error and how should I proceed?
Gemfile:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'shopify_api'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.6'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'simple_form'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
When I run the command rails generate --help
I get the following
C:Sitespostgresapp>rails generate --help
Usage: rails generate GENERATOR [args] [options]
General options:
-h, [--help] # Print generator's options and usage
-p, [--pretend] # Run but do not make any changes
-f, [--force] # Overwrite files that already exist
-s, [--skip] # Skip files that already exist
-q, [--quiet] # Suppress status output
Please choose a generator below.
Rails:
assets
channel
controller
generator
helper
integration_test
jbuilder
job
mailer
migration
model
resource
scaffold
scaffold_controller
task
Coffee:
coffee:assets
Graphql:
graphql:enum
graphql:install
graphql:interface
graphql:loader
graphql:mutation
graphql:object
graphql:union
Js:
js:assets
SimpleForm:
simple_form:install
TestUnit:
test_unit:generator
test_unit:plugin
EDIT: I have found a partial answer to my question. from the Gem documentation it states:
This gem requires Ruby 2.3.1 as of version 4.3. If you need to use an
older Ruby version then update your Gemfile to lock onto an older
release than 4.3.
Since I am using ruby version 2.2.6 I need to specify an older version of the gem. so I will narrow my question down further to: how can I know which version of the Shopify Gem to use?
2
Answers
bundle list
will list all of your gems with their versionsbundle list | grep shopify
will show you details about your Shopify gemI think you need to include
gem 'shopify_app'
into your gemfile and bundle install again. I can see you have theshopify_api
gem but not theshopify_app
gem which has the generator.