【问题标题】:assets:precompile - permission denied - only on one computer资产:预编译 - 权限被拒绝 - 仅在一台计算机上
【发布时间】:2012-10-14 21:20:10
【问题描述】:

我的 Dropbox 文件夹中有一个 rails app 项目文件夹。

我在两台电脑上工作——家用电脑和一台笔记本电脑(都是 win 7)

如果我在电脑上执行bundle exec rake assets:precompile,它工作正常,我看到了这条线

C:/Ruby193/bin/ruby.exe C:/Ruby193/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
mkdir -p H:/My Dropbox/project/public/assets
cp -r C:/Ruby193/lib/ruby/gems/1.9.1/gems/tinymce-rails-3.5.7.1/vendor/assets/javascripts/tinymce H:/My Dropbox/project/public/assets

但在笔记本电脑上,我对其中一个 tinymce 文件的权限被拒绝,并且预编译失败..

app 文件夹对每个人都有权限.. 任何想法为什么会发生这种情况?

更新:

它似乎随机停止在文件上..不一定是tinymce。 我已将所有 ruby​​ 文件和项目文件设置为对所有人都具有权限(win 7),并将所有只读设置为不具有权限。

这很令人沮丧

--trace 输出示例。请注意,每次我运行 assets:precompile 它都会在不同的文件处停止。这次它停在我的一个图标上

H:\My Dropbox\project>bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
C:/Ruby193/bin/ruby.exe C:/Ruby193/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Permission denied - H:/My Dropbox/project/public/assets/Icons/ArrowDown-335eb652931bdc13061ad1745a25556f.jpg
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/static_asset.rb:47:in `utime'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/static_asset.rb:47:in `write_to'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/static_compiler.rb:41:in `block in write_asset'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/static_compiler.rb:38:in `tap'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/static_compiler.rb:38:in `write_asset'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/static_compiler.rb:24:in `block in compile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:212:in `block in each_logical_path'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:200:in `block (2 levels) in each_file'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in `each_entry'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:198:in `block in each_file'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in `each_file'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:210:in `each_logical_path'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/static_compiler.rb:18:in `compile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/assets.rake:56:in `internal_precompile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `call'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `call'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
C:/Ruby193/bin/rake:32:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [C:/Ruby193/bin/ruby.exe C:/Ruby193/bin/rak...]
C:/Ruby193/lib/ruby/1.9.1/rake/file_utils.rb:53:in `block in create_shell_runner'
C:/Ruby193/lib/ruby/1.9.1/rake/file_utils.rb:45:in `call'
C:/Ruby193/lib/ruby/1.9.1/rake/file_utils.rb:45:in `sh'
C:/Ruby193/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `sh'
C:/Ruby193/lib/ruby/1.9.1/rake/file_utils.rb:80:in `ruby'
C:/Ruby193/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `ruby'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/assets.rake:12:in `ruby_rake_task'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `call'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
C:/Ruby193/bin/rake:32:in `<main>'
Tasks: TOP => assets:precompile

【问题讨论】:

  • 一些可以尝试的事情: 1. 确保 Dropbox 文件夹的权限 are set recursively。 2. Clean it all out 再试一次。 3. 听起来不像是同步问题,但如果 Dropbox 文件夹安装在 NTFS 上 - 请尝试 mounting it with you as user。在rake 命令中使用--trace 标志是否提供更多信息?
  • 故事的寓意:不要在 Windows 上使用 Ruby 进行开发。这是一系列令人头疼的问题之一。

标签: ruby-on-rails-3 tinymce asset-pipeline precompile


【解决方案1】:

从消除可能的问题开始。

首先,从等式中删除 DropBox。检出并在本地硬盘上编译。

其次,确保 TinyMCE 在您的 Gemfile 中并与 bundler 一起安装。您的项目不应从全局 gem 中提取 gem,而是从项目特定的捆绑 gem 中提取。

如果失败,您需要遵循 Digital Cake 的建议并向我们提供 --trace 输出。

【讨论】:

  • 保管箱位于本地硬盘上。当没有其他计算机在工作并且没有其他人访问该文件夹时,我尝试编译。似乎不仅 TinyMCE 造成了麻烦.. 我已经添加了跟踪
  • 我仍然怀疑“我的 Dropbox”文件夹。您可以尝试从 C:\ 驱动器上的某个位置进行编译吗?该错误可能意味着很多事情,没有空间,一些硬盘驱动器问题使这些位不可写,等等......
【解决方案2】:

这是一个猜测,但我认为该权限是因为 tmp 折叠用于临时存储文件,因为它们是预编译的。 a --trace 应该为您提供更好的错误日志,这将是找出错误发生位置的关键。

【讨论】:

    猜你喜欢
    • 2022-08-18
    • 1970-01-01
    • 2022-07-25
    • 2012-05-14
    • 1970-01-01
    • 1970-01-01
    • 2017-11-21
    • 1970-01-01
    • 2016-12-10
    相关资源
    最近更新 更多