Users Mihai_Raulea and shisongsong reported encountering a rake db:migrate error within a Vagrant environment, specifically an Errno::ENOENT failure regarding a missing ember-data.js file alongside a Sprockets deprecation warning. Mihai_Raulea noted the issue occurred on Mac OS X El Capitan and also affected a production Ubuntu VPS. Mittineague suggested trying the “Discourse as Your First Rails App” guide first, while cpradio provided a link to a setup guide and hypothesized a compatibility issue. cpradio successfully recreated a fresh Vagrant instance without errors and requested diagnostic output (bundle check, bundle show sprockets) from the affected users to compare versions. shisongsong eventually resolved the issue by uninstalling the ember-rails gem and removing the version constraint in the Gemfile before running bundle install again.
vagrant@discourse:/vagrant$ bundle exec rake db:migrate
DEPRECATION WARNING: Sprockets method register_engine is deprecated.
Please register a mime type using register_mime_type then
use register_compressor or register_transformer.
(called from <top (required)> at /vagrant/lib/es6_module_transpiler/sprockets.rb:3)
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /home/vagrant/.rvm/gems/ruby-2.3.1/gems/ember-data-source-2.3.0.beta.5/dist/ember-data.js
I thought vagrant was supposed to make this painless?
hello, thanks for your answer! this is exactly where the error occurs; inside the vagrant env. i am not a newbie, but i am no ruby dev. the production(a VPS with Ubuntu) offers the same exquisite error.
I know @tarek did some work on the vagrant image a short while ago, so you may want to check out this topic (ignore anything at the OS level but anything after vagrant ssh is fair game)
Hopefully sometime towards this weekend, I’ll be able to find time to try a fresh vagrant setup. I know I won’t have time today, but I’ll try to see if I can work something in later in this week (granted, I don’t own a Mac, so it will be a slightly different experience, but if your issues are truly within Vagrant itself, it shouldn’t matter).
So my sound rehearsal ended early tonight and I got a chance to destroy my current vagrant image and up it again… and it works. I don’t get any errors about sprockets
Can you run the following after vagrant ssh?
cd /vagrant
bundle check
bundle show sprockets
Here are my results, for comparison:
vagrant@discourse:/vagrant$ bundle check
The Gemfile's dependencies are satisfied
vagrant@discourse:/vagrant$ bundle show sprockets
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/sprockets-3.6.3
here it is:
songsong@Gialib001deMini:~/Workspace/github/discourse|master⚡
⇒ rake db:migrate
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from <top (required)> at /Users/songsong/Workspace/github/discourse/lib/es6_module_transpiler/sprockets.rb:3)
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/songsong/.rvm/gems/ruby-2.3.0/gems/ember-data-source-2.3.0.beta.5/dist/ember-data.js
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/ember-rails-0.18.5/lib/ember_rails.rb:68:in `block in <class:Railtie>'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `instance_exec'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `run'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:54:in `run_initializers'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/application.rb:352:in `initialize!'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `public_send'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `method_missing'
/Users/songsong/Workspace/github/discourse/config/environment.rb:5:in `<top (required)>'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/application.rb:328:in `require_environment!'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/railties-4.2.7.1/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/Users/songsong/.rvm/gems/ruby-2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/Users/songsong/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/songsong/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => environment
Can you run the following? I still can’t recreate this and so I’m trying to figure out why Vagrant is behaving differently for you and @Mihai_Raulea than it is for me.
cd /vagrant
ruby -v
bundle check
bundle show sprockets
I have
vagrant@discourse:/vagrant$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
vagrant@discourse:/vagrant$ bundle check
The Gemfile's dependencies are satisfied
vagrant@discourse:/vagrant$ bundle show sprockets
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/sprockets-3.6.3
No such file or directory @ rb_sysopen - /Users/songsong/.rvm/gems/ruby-2.3.0/gems/ember-data-source-2.3.0.beta.5/dist/ember-data.js
So I checked the /Users/songsong/.rvm/gems/ruby-2.3.0/gems/ember-data-source-2.3.0.beta.5/, no /dist dictionary here.
Then I uninstall the ember-rails gem and modify Gemfile: I remove the version after gem ‘ember-rails’, next run bundle install again, and it worked for me.
Thanks a lot