Ruby on Rails: permission denied when using “rails generate controller welcome”

前端 未结 6 1377
Happy的楠姐
Happy的楠姐 2020-12-25 13:25

I used Ruby on Rails on Red Hat server. When I trying to generate a controller file, I got this error:

[ec2-user@ip-172-31-22-128 testApp4]$ rails generate          


        
6条回答
  •  情书的邮戳
    2020-12-25 13:52

    I took a look at the library that's trying to write the pid file, lib/spring/env.rb.

    The function in question tries to create a temporary directory at the same location each time unless the XDG_RUNTIME_DIR is set:

    path = Pathname.new(File.join(ENV['XDG_RUNTIME_DIR'] || Dir.tmpdir, "spring"))

    Setting said variable to a unique directory does the trick for me:

    export XDG_RUNTIME_DIR=/tmp/`whoami`
    

提交回复
热议问题