windows ruby on rails搭建搭建

2021年8月17日12:28:04

 

widnows ruby下载:

https://rubyinstaller.org/downloads/

注意:Ruby+Devkit 3.0.2-1 (x64)  注意下这个带Devkit 版本,不然你需要重新安装Devkit 

如果下载不下来直接把地址复制到迅雷下载

 

下载按照默认安装完之后,在弹出的cmd狂口输入 1,3

慢慢等待安装完,默认安装完自动加入了环境变量

ruby -v

ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]

如果不行就吧ruby加入环境变量

 

安装gems

在  https://rubygems.org/   官网

https://rubygems.org/pages/download 下载zip文件

解压之后

ruby setup.rb

然后

gem -v

3.2.25

安装nodejs 建议使用12 或者14的版本,不用最新

npm -v 6.14.13

node -v  v14.17.3

 

然后安装rails

更换镜像 国内镜像 https://gems.ruby-china.com/

$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
$ gem sources -l
https://gems.ruby-china.com

ruby on rails中文文档

https://ruby-china.github.io/rails-guides/index.html

https://rails.ruby.tw/index.html

gem install rails

慢慢等

修改

Gemfile 
source 'http://gems.ruby-china.com/'

创建应用

rails new blog
npm install yarn -g
rails webpacker:install

 

进入目录运行项目

ruby bin\rails server

-p是指定端口

 

添加路由

ruby bin/rails generate controller Welcome index

 

 

 

 

 

 
 

 

posted on 2021-08-17 13:39  zh7314  阅读(95)  评论(0编辑  收藏  举报