gpt4 book ai didi

ruby-on-rails - 权限被拒绝@dir_s_mkdir -/run/user/gui/spring (Errno::EACCES)

转载 作者:行者123 更新时间:2023-12-02 02:08:15 26 4
gpt4 key购买 nike

我在打开 -> Rails 控制台时遇到此问题

[chitra@localhost todo_app]$ rails c
/home/chitra/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/fileutils.rb:252:in `mkdir': Permission denied @ dir_s_mkdir - /run/user/gui/spring (Errno::EACCES)
from /home/chitra/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir'
from /home/chitra/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
from /home/chitra/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each'
from /home/chitra/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
from /home/chitra/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/fileutils.rb:210:in `each'
from /home/chitra/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/env.rb:37:in `tmp_path'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/env.rb:54:in `pidfile_path'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/env.rb:69:in `server_running?'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/client/run.rb:25:in `call'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/client/command.rb:7:in `call'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/client/rails.rb:24:in `call'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/client/command.rb:7:in `call'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/client.rb:28:in `run'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/bin/spring:49:in `<top (required)>'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/binstub.rb:11:in `load'
from /home/chitra/.rvm/gems/ruby-2.2.0@todo/gems/spring-1.4.0/lib/spring/binstub.rb:11:in `<top (required)>'
from /opt/projects/todo_app/bin/spring:13:in `require'
from /opt/projects/todo_app/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

我使用的是 ruby​​ 版本 2.2.0p0 和 Rails 4.2。任何帮助将不胜感激。

最佳答案

这是引发错误的代码:

# File 'lib/spring/env.rb', line 35

def tmp_path
path = Pathname.new(File.join(ENV['XDG_RUNTIME_DIR'] || Dir.tmpdir, "spring"))
FileUtils.mkdir_p(path) unless path.exist?
path
end

看起来您已将 XDG_RUNTIME_DIR 设置为 /run/user/gui/ 但服务器没有对该目录的写入权限。因此,您可以授予对该目录的访问权限,也可以通过输入 unset XDG_RUNTIME_DIR

取消设置 XDG_RUNTIME_DIR

关于ruby-on-rails - 权限被拒绝@dir_s_mkdir -/run/user/gui/spring (Errno::EACCES),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32708726/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com