我對 Ruby on Rails 很陌生。我通過運行 rails g scaffold 命令創建了一個模型,然后嘗試在 wsl 終端中運行 rails db:migrate ,這給了我這個巨大的錯誤:
rails db:migrate
/home/nidhi/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.1.4.1/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Rails Error: Unable to access log file. Please ensure that /mnt/c/Windows/system32/railsfriends/friends/log/development.log exists and is writable (ie, make it writable for user and group: chmod 0664 /mnt/c/Windows/system32/railsfriends/friends/log/development.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
(0.6ms) SELECT sqlite_version(*)
(0.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
rails aborted!
ActiveRecord::StatementInvalid: SQLite3::ReadOnlyException: attempt to write a readonly database
/mnt/c/Windows/system32/railsfriends/friends/bin/rails:5:in `<top (required)>'
/mnt/c/Windows/system32/railsfriends/friends/bin/spring:10:in `block in <top (required)>'
/mnt/c/Windows/system32/railsfriends/friends/bin/spring:7:in `tap'
/mnt/c/Windows/system32/railsfriends/friends/bin/spring:7:in `<top (required)>'
Caused by:
SQLite3::ReadOnlyException: attempt to write a readonly database
/mnt/c/Windows/system32/railsfriends/friends/bin/rails:5:in `<top (required)>'
/mnt/c/Windows/system32/railsfriends/friends/bin/spring:10:in `block in <top (required)>'
/mnt/c/Windows/system32/railsfriends/friends/bin/spring:7:in `tap'
/mnt/c/Windows/system32/railsfriends/friends/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
我嘗試取消選中它提到的 development.log 檔案的“只讀”屬性,但這沒有幫助。我該如何解決這個錯誤?
uj5u.com熱心網友回復:
重新啟動我的電腦對我有用!我只需要轉到我的原始檔案夾并取消選中“只讀”屬性,然后重新啟動計算機。該rails db:migrate命令現在有效。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/345055.html
標籤:红宝石轨道
