redmine3.3.3 rake db:migrate 报错invalid byte sequence in US-ASCII (Argument Error) 解决方法

这个错误有点莫名其妙,系统默认的就是utf-8,可bundle就是不对。。

rake db:migrate 结果没有任何错误,反而是网页passenger 提示了这个错误

参考:https://github.com/imathis/octopress/issues/144

解决方法:

  • 在 ~/.bash_profile 中添加一行 export RUBYOPT="-KU -E utf-8:utf-8"
$ cat ~/.bash_profile

[[-s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

export RUBYOPT="-KU -E utf-8:utf-8"

  清空gem后再次bundle就可以了。我用的ruby 1.9.3 + redmine 3.3.3;请根据自己的环境调节命令。

rvm gemset empty

rvm use 1.9.3 --default;gem install bundler;sudo rm -rf Gemfile.lock;bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32 java;bundle install --without development test

bundle exec rake redmine:plugins:migrate RAILS_ENV=production;sudo service apache2 reload;sleep 2;sudo service apache2 restart

重新打开网页显示正常。

原文地址:https://www.cnblogs.com/wangbaobao/p/7127168.html