Unable to create Vagrant local installation

I followed the instruction below to install Discourse on my local windows system

I got below error after the command bundle exec rake db:migrate

Could not find module pretty-text/pretty-text

Error raised on the line

== Seed from /vagrant/db/fixtures/500_lounge_category.rb

For more details i attached the error below

== Seed from /vagrant/db/fixtures/009_users.rb
 - User {:id=>-1, :name=>"system", :username=>"system", :username_lower=>"system", :email=>"no_email", :password=>"180b8ba3113f54b33d61a313277c4f01", :active=>true, :admin=>true, :moderator=>true, :approved=>true, :trust_level=>4}

== Seed from /vagrant/db/fixtures/500_lounge_category.rb
rake aborted!
MiniRacer::RuntimeError: Error: Could not find module pretty-text/pretty-text/nError: Could not find module pretty-text/pretty-text
JavaScript at missingModule (<anonymous>:117:11)
JavaScript at requireModule (<anonymous>:127:17)
JavaScript at <anonymous>:1:16
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.3/lib/mini_racer.rb:99:in `eval_unsafe'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.3/lib/mini_racer.rb:99:in `block in eval'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.3/lib/mini_racer.rb:97:in `synchronize'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.3/lib/mini_racer.rb:97:in `eval'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/mini_racer-0.1.3/lib/mini_racer.rb:93:in `load'
/vagrant/lib/pretty_text.rb:82:in `create_es6_context'
/vagrant/lib/pretty_text.rb:105:in `block in v8'
/vagrant/lib/pretty_text.rb:103:in `synchronize'
/vagrant/lib/pretty_text.rb:103:in `v8'
/vagrant/lib/pretty_text.rb:124:in `block in markdown'
/vagrant/lib/pretty_text.rb:359:in `block in protect'
/vagrant/lib/pretty_text.rb:358:in `synchronize'
/vagrant/lib/pretty_text.rb:358:in `protect'
/vagrant/lib/pretty_text.rb:123:in `markdown'
/vagrant/lib/pretty_text.rb:211:in `cook'
/vagrant/app/models/post_analyzer.rb:17:in `cook'
/vagrant/app/models/post.rb:219:in `cook'
/vagrant/lib/post_creator.rb:203:in `before_create_tasks'
/vagrant/app/models/post.rb:480:in `block in <class:Post>'

I think the problem is raised at require statement in below file

https://github.com/discourse/discourse/blob/master/lib/pretty_text/shims.js

require('pretty-text/pretty-text')

Finally I fixed it myself (check below PR). Just one line code fixed it.

https://github.com/discourse/discourse/pull/4421

Here when we use Regexp without chomp it have some weird last line char. (maybe \n). Without this change initial db migration failing always in Vagrant with == Seed from /vagrant/db/fixtures/500_lounge_category.rb.

Also I am not facing this issue in docker installation. Even in Ubuntu development guide. Only in Vagrant. Weird :imp:

Edit: File are in Windows PC. Maybe that’s the reason

1 Like