【问题标题】:Cannot Create A New Rails Project Due To chmod由于 chmod,无法创建新的 Rails 项目
【发布时间】:2014-08-26 20:23:25
【问题描述】:

我不知道发生了什么变化,但最近当我尝试创建一个新的 Rails 项目时出现错误

/home/eric/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/fileutils.rb:1348:in `chmod': Operation not permitted @ chmod_internal - /mnt/Data/Code/foodFinder/bin (Errno::EPERM)

如果我然后他们使用Rails s 运行它,我会收到错误

bin/rails:3:in `require_relative': cannot load such file -- /mnt/Data/Code/foodFinder/config/boot (LoadError)
from bin/rails:3:in `<main>'

我所有的旧项目似乎仍然运行良好。然而,一个可能的相关错误是,如果我尝试 init 一个新的 git 存储库。例如,如果我进入 foodFinder 文件夹并运行 git init 我会得到错误

error: chmod on /mnt/Data/Code/foodFinder/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/Data/Code/foodFinder/.git/config.lock failed: Operation not permitted
error: chmod on /mnt/Data/Code/foodFinder/.git/config.lock failed: Operation not permitted
Initialized empty Git repository in /mnt/Data/Code/foodFinder/.git/

这里发生了什么?这真的很令人沮丧,并且完全阻止了我在 Rails 中做任何新的事情。

【问题讨论】:

  • /mnt 把我吓坏了。您是否尝试在只读挂载磁盘上创建项目?
  • 您运行的确切命令是什么,在哪个用户下以及在哪个文件夹中?
  • @KaiMattern,这是因为我在安装的硬盘上,而不是试图将所有代码都放在我的小型 SSD 上。它不是只读驱动器;我以前开发过。
  • 您可以尝试一个简单的“touch /mnt/Data/Code/foodFinder/test.txt”,看看是否有错误。然后您就知道该挂载对于您的用户是不可写的。
  • @jefflunt,我使用的确切命令是“Rails new foodFinder”,它会生成第一个错误。其他错误由前面的内联命令给出

标签: ruby-on-rails git chmod


【解决方案1】:

我找到了解决问题的方法。正如 KaiMattern 所想的那样, 问题在于挂载选项。我需要为我设置 uid(通过将 uid=eric 添加到 fstab 选项来完成)。在此之前,它已默认设置为 root。

我不知道它是如何改变的,但它解决了我的问题。

【讨论】:

  • ntfs 分区也有同样的问题。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-24
  • 1970-01-01
  • 2021-09-25
相关资源
最近更新 更多