ruby 安装
1、从rubyinstaller.org下载Ruby+Devkit的安装包,我下载的是rubyinstaller-devkit-2.5.3-1-x64.exe,2.6系列的下的太慢没下载下来
2、安双击装,全部选中安装,在安装结束时,去除ridk install的选项。
3、更新msys2源,查找Ruby安装目录下的msys64\etc\pacman.d,编辑更新源,加入文件的首位:
mirrorlist.mingw32
Server =Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686
mirrorlist.mingw64
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64
mirrorlist.msys
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch
4、配置msys2关闭sigLevel,msys64\etc\pacman.conf
SigLevel = Never
#SigLevel = Required DatabaseOptional
在命令行执行ridk install(如果安装时选择了不加入系统环境变量的,去Ruby安装目录的bin之下执行),一路回车至结束;
5、更新gem源:
gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://rubygems.org/
6、打开命令窗口,输入执行ridk install,选择3安装
sqlite3安装
1、安装sqlite3
ridk exec pacman -S mingw-w64-x86_64-sqlite3
gem inst sqlite3 platform=ruby
2、如果出现下面错误
gem inst sqlite3 platform=ruby
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
警告:mingw-w64-x86_64-sqlite3-3.27.2-2 已经为最新 -- 跳过
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby25/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/Ruby25/bin/ruby.exe -r ./siteconf20190312-9220-vnk92g.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... no
checking for dlopen()... no
missing function dlopen
*** 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:/Ruby25/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
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--with-pthreadlib
--without-pthreadlib
--with-dllib
--without-dllib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/Ruby25/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby25/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0 for inspection.
Results logged to C:/Ruby25/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/gem_make.out
ERROR: Could not find a valid gem 'platform=ruby' (>= 0) in any repository
ERROR: Possible alternatives: platform_lib, affirm-ruby, flavordb-ruby, fontforge-ruby, latexml-ruby
在命令行中执行下面的语句,完成sqlit的安装
ridk exec pacman -S mingw-w64-x86_64-dlfcn
gem install sqlite3 -v 1.4.0
rails安装
gem install rails
参考
win10 安装msys2 和 ruby
快速安装rubyinstaller-devkit
Sqlite error while creating a rails project on Windows