简体   繁体   English

gem install 和 bundle install 无法安装 sqlite3

[英]gem install and bundle install fails to install sqlite3

I'm new to Rails, and I'm learning it from The Ruby on Rails Tutorial.我是 Rails 的新手,我正在从 Ruby on Rails 教程中学习它。 The bundle install command shows this error when I use gem 'sqlite3' in Gemfile;当我在 Gemfile 中使用gem 'sqlite3'时, bundle install命令显示此错误;

    An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
    Make sure that `gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'`
    succeeds before bundling.

In Gemfile:
  sqlite3

I found a solution to this over here - https://medium.com/@declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b , that suggested that gem 'sqlite3' should be replaced with gem 'sqlite3', git: “https://github.com/larskanis/sqlite3-ruby", branch: “add-gemspec” . On running bundle install after upating Gemfile, all the required gems, including sqlite3, appear to have installed;我在这里找到了解决方案 - https://medium.com/@declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b ,建议gem 'sqlite3'应该替换为gem 'sqlite3', git: “https://github.com/larskanis/sqlite3-ruby", branch: “add-gemspec” 。在更新 Gemfile 后运行bundle install时,所有必需的 gem,包括 sqlite3,似乎已经安装;

Bundle complete! 15 Gemfile dependencies, 70 gems now installed.
Use 'bundle info [gemname]' to see where a bundled gem is installed.

But on running the command sqlite3 --version , I still get the error message that says但是在运行命令sqlite3 --version时,我仍然收到错误消息

'sqlite3' is not recognized as an internal or external command,
operable program or batch file.

I have also referred to various stackoverflow answers, but none of them seem to work.我还提到了各种 stackoverflow 答案,但它们似乎都不起作用。 gem install sqlite3 is also not working. gem install sqlite3也不起作用。 Please help.请帮忙。

try it helped试试看有帮助

sudo apt-get install libsqlite3-dev sudo apt-get 安装 libsqlite3-dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM