標籤:

備忘131228

有時候配置好環境的伺服器上運行rails c production會報錯

-bash: rails: command not foundn

這時可以嘗試下

bundle exec rails cn

有時候連接Mysql會報錯

ERROR 2002 (HY000): Cant connect to local MySQL server through socket /var/run/mysqld/mysql.sock (2)n

這時可以先ps ax | grep mysql查看進程是否在運行,如果沒有在運行

sudo service mysql startn

參考:ERROR 2002 (HY000): Cant connect to local MySQL server through socket /var/run/mysqld/mysql.sock (2)

有時候在運行一些命令時Ubuntu會報錯

Sorry, command-not-found has crashed! Please file a bug report at:nhttps://bugs.launchpad.net/command-not-found/+filebugnPlease include the following information with the report:nnncommand-not-found version: 0.2.44n

很有可能你也見到了要求檢查語言的警告

這時

#sudo vim /root/.bashrcnnlocale-gennn在尾部加入以下定義:nexport LC_CTYPE=en_US.UTF-8nexport LC_ALL=en_US.UTF-8nn#source /root/.bashrc   ——>使用環境即時生效nn然後用dpkg-reconfigure locales測試看是否還會報錯n

參考:

1、Sorry, command-not-found has crashed!

2、Ubuntu 配置VNC時,出現「perl: warning: Falling back to the standard locale ("C").」等提示錯誤解決方法

有時候rake版本不對,報錯

You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7n

在Gemfile中明確rake的版本,如gem rake,0.8.7,然後bundle update rake升級

參考:You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7

有時候rails 4生成的應用不載入css,這時要在production.rb中解除

config.assets.css_compressor = :sass 的注釋


推薦閱讀:

極光日報 第 207-208 期 | 2017 / 7 / 5 - 6
matlab 降低演算法時間複雜度的方法?
Python3 CookBook | 數據結構和演算法(二)
scanf_s 比起 scanf 添加了什麼?
關於漢字、亂碼和其他

TAG:编程 |