部署在公共目录中找不到资产文件夹

我使用的是ror 3.1 rc4,在部署到生产服务器时,找不到图像,样式表和JavaScript目录,并且部署失败。我确实有deploy.rb部署在公共目录中找不到资产文件夹

namespace :deploy do 

task :start do ; end

task :stop do ; end

desc "Restarting mod_rails with restart.txt"

task :restart, :roles => :app, :except => { :no_release => true } do

run "touch #{current_path}/tmp/restart.txt"

end

task :precompile do

run "cd #{release_path}; RAILS_ENV=production rake assets:precompile"

end

end

after 'deploy:update_code', 'deploy:precompile'

这里需要的代码是错误,我得到

executing "find /var/www/nattyvelo/releases/20110624033801/public/images /var/www/nattyvelo/releases/20110624033801/public/stylesheets /var/www/nattyvelo/releases/20110624033801/public/javascripts -exec touch -t 201106240338.03 {} ';'; true" 

servers: ["66.228.39.243"]

[66.228.39.243] executing command

** [out :: 66.228.39.243] find: `/var/www/nattyvelo/releases/20110624033801/public/images'

** [out :: 66.228.39.243] : No such file or directory

** [out :: 66.228.39.243] find: `/var/www/nattyvelo/releases/20110624033801/public/stylesheets'

** [out :: 66.228.39.243] : No such file or directory

** [out :: 66.228.39.243] find: `/var/www/nattyvelo/releases/20110624033801/public/javascripts'

** [out :: 66.228.39.243] : No such file or directory

command finished in 705ms

triggering after callbacks for `deploy:update_code'

* executing `bundle:install'

* executing "ls -x /var/www/nattyvelo/releases"

servers: ["66.228.39.243"]

[66.228.39.243] executing command

command finished in 595ms

* executing "cd /var/www/nattyvelo/releases/20110624033801 && bundle install --gemfile /var/www/nattyvelo/releases/20110624033801/Gemfile --path /var/www/nattyvelo/shared/bundle --deployment --quiet --without development test"

servers: ["66.228.39.243"]

[66.228.39.243] executing command

** [out :: 66.228.39.243] bash: bundle: command not found

command finished in 604ms

*** [deploy:update_code] rolling back

* executing "rm -rf /var/www/nattyvelo/releases/20110624033801; true"

回答:

你必须通过它的外观一个PATH问题:

** [out :: 66.228.39.243] bash: bundle: command not found 

你需要修复你的环境变量PATH

回答:

您可能必须在生产服务器中安装捆绑软件。

sudo gem install bundler 

回答:

这里发生了两个错误。

第一个是在Rails 3.1应用程序中不再有public/imagespublic/stylesheetspublic/javascripts文件夹。他们都被搬进了app/assets。但是,如果您运行rake assets:precompile那么是一个public/assets文件夹。这是您的应用程序的静态资产将被提供的地方。

无论在您的部署脚本中引用这三个文件夹是否需要停止这样做,否则您将继续出现此错误。


第二个错误是,就像我之前的其他两个人有种建议,你需要在服务器上安装Bundler gem。

以上是 部署在公共目录中找不到资产文件夹 的全部内容, 来源链接: utcz.com/qa/259775.html

回到顶部