bundle exec rake test:models throws Errno::EACCES: Permission denied

前端 未结 4 1679
囚心锁ツ
囚心锁ツ 2020-12-19 19:41

I am doing the draft version of the railstutorial, when I try to run bundle exec rake test:models I get this error message:

rake aborted!
Errno:         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 20:38

    Yes, the issue is with Windows. when you read the code for fileutils.rb found in railsinstaller directory. It wants to unlink and want to give permission 700(which is found in unix/linux) but not in windows. so will not work.

    Here is the snippet from the fileutil.rb file.

    def remove_file
      platform_support {
        File.unlink path
      }
    end
    
    def platform_support
      return yield unless fu_windows?
      first_time_p = true
      begin
        yield
      rescue Errno::ENOENT
        raise
      rescue => err
        if first_time_p
          first_time_p = false
          begin
            File.chmod 0700, path()   # Windows does not have symlink
            retry
          rescue SystemCallError
          end
        end
        raise err
      end
    end
    

提交回复
热议问题