Demo does not work #520

Open
antifarben opened this Issue May 13, 2012 · 9 comments

6 participants

@antifarben

I just tried "Creating a Demo Website" on the wiki ( https://github.com/browsermedia/browsercms/wiki/Getting-Started ) but if I run $ rake db:install it will end with

db/test.sqlite3 already exists
db/development.sqlite3 already exists
-- create_Cms::User(:cmsadmin)
rake aborted!
Could not find table 'users'

Tasks: TOP => db:install => db:seed
(See full trace by running task with --trace)

I use ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

@peakpg

It sounds like there are no migrations in the project. Verify there are files like db/migrate/XXX_browsercms300.rb in the project. If not, the project probably had failure during creation (possibly due to sqlite3 not being installed first).

Recommended solution:
1. Remove and regenerate the project

$ rm -rf project_name
$ bcms demo project_name

Look for any errors during the project creation, then try db:install again. If you still have issues, post the stack trace to this thread.

@alainpatrick

Demo website still not working. There is no migration file in db/
Your recommended solution doesn't work either, nor does db:install

$ rake db:install --trace
** Invoke db:install (first_time)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:create
db/development.sqlite3 already exists
db/test.sqlite3 already exists
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:abort_if_pending_migrations
-- create_Cms::User(:cmsadmin)
rake aborted!
Could not find table 'users'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:472:in table_structure'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:346:in
columns'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/schema_cache.rb:12:in block in initialize'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in
yield'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in default'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in
columns'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:243:in column_defaults'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/base.rb:482:in
initialize'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/browsercms-3.5.4/lib/cms/data_loader.rb:30:in new'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/browsercms-3.5.4/lib/cms/data_loader.rb:30:in
create'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/browsercms-3.5.4/lib/cms/data_loader.rb:17:in method_missing'
/home/alpat/Documents/devprojects/rails_projects/demobcms/db/browsercms.seeds.rb:9:in
'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in require'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in
block in require'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in load_dependency'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in
require'
/home/alpat/Documents/devprojects/rails_projects/demobcms/db/seeds.rb:9:in <top (required)>'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in
load'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in block in load'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in
load_dependency'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in load'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/engine.rb:520:in
load_seed'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:309:in block (2 levels) in <top (required)>'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
call'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in block in execute'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
each'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in execute'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in
block in invoke_with_call_chain'
/home/alpat/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
invoke_with_call_chain'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:176:in block in invoke_prerequisites'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in
each'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in invoke_prerequisites'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:157:in
block in invoke_with_call_chain'
/home/alpat/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
invoke_with_call_chain'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in invoke'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
invoke_task'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block (2 levels) in top_level'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
each'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block in top_level'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in top_level'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in
block in run'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in
run'
/home/alpat/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/bin/rake:33:in <top (required)>'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in
load'
/home/alpat/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in `

'
Tasks: TOP => db:install => db:seed

@peakpg

If there are no migrations in the project, you will need to add them manually. You can do by running:

$ rake cms:install:migrations
$ rake db:install

This should hopefully work around the issue you are seeing.

What I'm more curious about is why migrations are not getting added to your project during project generation. Can you post the complete output of the commandline when you run the following:

$ bcms demo myproject
@alainpatrick

Thank you very much it works now !

I think I found the reason reason why the database wasn't generated; there is an error message saying that the javascript runtime couldn't be found.

rake cms:install:migrations
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.

@peakpg
@alainpatrick

Yes, that's correct. I had to add the lines you mentioned. Thanks a lot for your help. And it's a good idea to have them added into the coming CMS project.

@abrambailey

+1 for adding the correct gems to the linux version. Thanks!

Actually, this issue became very annoying for me when trying to start a real project (even worse than for the demo project). The quick workaround was to run bcms new project_name ... then when it hits the errors it stops and doesn't even create the view templates. So, then I updated the gemfile that was created with therubyracer and did bcms new project_name again and allowed overwrite of everything except the gemfile.

@dwayne

This problem seems to still be occurring. I installed rails and browsercms without a JavaScript runtime. Then remembering that I needed one (recently installed Ubuntu 12.04 on this VM), I installed node, but when I ran bundle exec rake db:install I ran into the same problem mentioned here.

However, first running rake cms:install:migrations did the trick. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment