konchanxxx / menta

MENTAのタスク管理用リポジトリ
0 stars 0 forks source link

データベースについて #7

Closed ghost closed 5 years ago

ghost commented 5 years ago

概要

データベースについて

実現したいこと

sqlite3をインストールしたい

困っていること

sqlite3をインストールしようとするとエラーが発生する

困っていることがバグの場合は事象やログ、エラーメッセージをできるだけそのまま(抜粋などしない)下記に記載してください。

gem install sqlite3 ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

解決するために行ったこと

参考書を読んで見たが原因がわからないので質問させていただきました

問題となっている箇所の予想

konchanxxx commented 5 years ago

permissions error というのはファイルの参照権限や実行権限がないことを意味しています。 gemをインストールするときに sudoとかを使うというこういったエラーに陥りがちです。 おそらくRubyがroot権限でインストールされているのだと思います。 You don't have write permissions なので書き込み権限がないということです。

rbenv というツールがあるのでそちらをインストールしてRubyを入れ直すのが良いかなと思います! https://qiita.com/Alex_mht_code/items/d2db2eba17830e36a5f1

konchanxxx commented 5 years ago

あとRails環境で実行するならgemを直接インストールするよりもbundler経由でインストールするのが良いかなと思います。 bundle install --path vendor/bundle とかするとbundlerというgemを管理するツールを使ってRailsディレクトリのvendor/bundle配下にgemをインストールすることができます。 その際はインストールしたgemを管理対象外にしておいたほうが良いので vi .gitignore を実行してgitの管理対象外ディレクトリに vendor/bundleを追加するのが良いかなと思います。

# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
#   git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore uploaded files in development
/storage/*
!/storage/.keep

/node_modules
/yarn-error.log

/public/assets
.byebug_history

# Ignore master key for decrypting credentials and more.
/config/master.key

vendor/bundle <= これを追加する
konchanxxx commented 5 years ago

@username-ss こちら状況どうでしょうか?