新手问题 rails new 的时候卡住了,萌新求教,卡在这里一天了

FishAndWhale · 2020年08月16日 · 最后由 ShinkenNg 回复于 2020年10月03日 · 1957 次阅读

我想在 cli 中 rails new 一个练习用的小应用

执行到一半有报错

黄字让我 bundle install,敲完之后 然后我查了一天资料,零零散散的越看越头疼,不知道哪里出了问题,求指教,感谢

首先就没有安装 sqlite3 的头文件,然后应该是在项目的根目录运行 bundle …… 新手不建议用 windows,上 rubymine 吧

loyaqua 回复

windows 也可以用 rubymine 的吧?

xiaox 回复

是,用了 rubymine 就(应该)可以避开命令行

先通过 gem install sqlite3 来尝试安装先(缺少依赖必然会报错),然后上网搜索如何安装依赖的教程。一步步解决,这个问题以后装 mysql 的时候也有可能会遇到。😅 思路都差不多,我一般就是这样一步步去解决的。

安装一个 docker 环境,在里面跑 ror 吧。

先下载 slqite3 源码 https://www.sqlite.org/2020/sqlite-amalgamation-3330000.zip 然后解压到一个目录
然后 ggem install sqlite3 指定 include 文件目录 --with-sqlite3-include=你解压的目录

gem install  sqlite3 --  --with-sqlite3-include=d:\sqlite-amalgamation-3320300

hjf_coding 回复

感谢,我现在去弄 ubantu

tablecell 回复

感谢大佬,我敲了下,然后有一些密钥错误,弄不太懂

----------------------------以下是 mkmf.log---------------------------------------------

"pkg-config --exists sqlite3" package configuration for sqlite3 is not found find_header: checking for sqlite3.h... -------------------- no

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby26-x64/include/ruby-2.6.0/x64-mingw32 -IC:/Ruby26-x64/include/ruby-2.6.0/ruby/backward -IC:/Ruby26-x64/include/ruby-2.6.0 -I. -IC:\Program -D_USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D_MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -DTAINTING_SUPPORT conftest.c -L. -LC:/Ruby26-x64/lib -L. -pipe -s -lx64-msvcrt-ruby260 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi " checked program was: /* begin / 1: #include "ruby.h" 2: 3: #include 4: #include 5: int main(int argc, char **argv) 6: { 7: return 0; 8: } / end */

"x86_64-w64-mingw32-gcc -E -IC:/Ruby26-x64/include/ruby-2.6.0/x64-mingw32 -IC:/Ruby26-x64/include/ruby-2.6.0/ruby/backward -IC:/Ruby26-x64/include/ruby-2.6.0 -I. -IC:\Program -D_USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D_MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -DTAINTING_SUPPORT conftest.c -o conftest.i" conftest.c:5:10: fatal error: sqlite3.h: No such file or directory 5 | #include | ^~~~~~~~~~~ compilation terminated. checked program was: /* begin / 1: #include "ruby.h" 2: 3: #include 4: #include 5: #include / end */


------------------------------以下是 gem_make.out------------------------------------- current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.2/ext/sqlite3 C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20200818-1584-11k9q0w.rb extconf.rb --with-sqlite3-include=C:\Program Files\sqlite3\download_zip\sqlite-amalgamation-3330000 checking for sqlite3.h... no sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby26-x64/bin/$(RUBY_BASE_NAME) --with-sqlcipher --without-sqlcipher --with-sqlite3-config --without-sqlite3-config --with-pkg-config --without-pkg-config --with-sqlcipher --without-sqlcipher --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/sqlite3-1.4.2/mkmf.log

extconf failed, exit code 1

@FishAndWhale sqlite3 解压到一个简单的目录 比如 d:\lite 不要带空格也不要有中文 安装完再删除也不影响

gem install  sqlite3 --  --with-sqlite3-include=d:\lite\sqlite-amalgamation-3320300

如果觉得麻烦,你完全可以用 choco 安装 sqlite3,再安装 gem,现在用 windows 做 ror 未必就真的那么麻烦。只是资料不多。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号