新手问题 如何加载一个 copy 的 rails 工程

bluesky0318 · February 27, 2019 · Last by bluesky0318 replied at February 27, 2019 · 1161 hits

接手一个同事的项目,复制到本地后,进入目录,使用 rails s,失败;之后使用 bundle update gemfile,但是也报错,什么情况啊。应该如何加载呢?

你没有安装 bundler gem install bundler bundle install rails db:create rails db:migrate 配置 database.yml

Reply to gwq

安装了,一直报错,不知道为什么

你 bundler 都写错了

Reply to gwq

谢谢,改过来了,还是报错啊

bundle install

Reply to longzc

还是不行

我电脑上都不晓得什么时候装的 ruby 2.5.0 版本,只是 install bundler 时说我没有权限,然后 root 了一把,执行了 gem install bundler,就出现了 2.5.0 版本,是不是路径搞错了?

这也太新手了

Reply to teddyinfi

是新手呢

bundler 版本需要你更新哈

Reply to gwq

我觉得我需要先把 ruby 2.5.0 干掉

新手别搞了 找会的搞😀 你不是程序员为什么 会把项目交给你啊

还有啊 你要是打码就全打了 你这项目名貌似和公司网站一样的

找到原因了,我一开始是用 rvm 管理的 ruby 版本,后来加载同事这个工程的时候,发现 rails 不存在了,我个人理解是 ruby 是全局的,rails 版本是跟随项目走的,然后就去敲 bundle install,说我没有安装 bundle 这个 gem,安装过程中说我没有权限,需要输入密码,结果我理解成了 root 权限,就切换到 root 下安装 bundler,可能是那时候把 ruby2.5.1 安装进去了,这样版本就有问题了。所以目前解决方法为:

  1. Using which -a ruby I found out my ruby installation could be found in /usr/bin/ruby Well that's not exactly the case. I went to /usr/bin and listed all the folders/files in the bin directory` using ls -ln, and found out /usr/bin/ruby is just the alias. The actually path to the installation directory has the version appended, for me it was /usr/bin/ruby1.9.1. I was successfully able to uninstall ruby using sudo apt remove ruby1.9.1。同原理卸载 ruby2.5.1
  2. 载入 rvm 环境 source ~/.rvm/scripts/rvm 3.进入项目重新执行 bundle install,正常
Reply to kevinyu

这个还真没办法回复你,我也不懂什么叫程序员,哈哈哈。

bluesky0318 closed this topic. 27 Feb 09:53
You need to Sign in before reply, if you don't have an account, please Sign up first.