簡體   English   中英

Rails生成命令不起作用

[英]Rails generate commands not working

我正在嘗試使用rails生成器創建遷移,但是當我運行rails g migration create_meetups_table我得到以下輸出:

Could not find slop-3.4.7 in any of the sources
Run `bundle install` to install missing gems.

我手動安裝了gem,然后再次運行bundle install並得到了這個輸出:

Using i18n 0.6.9
Using json 1.8.1
Using minitest 5.3.4
Using thread_safe 0.3.4
Using builder 3.2.2
Using erubis 2.7.0
Using rake 10.3.2
Using rack 1.5.2
Using polyglot 0.3.5
Using mime-types 1.25.1
Using arel 5.0.1.20140414130214
Using bcrypt 3.1.7
Using coderay 1.1.0
Using coffee-script-source 1.7.0
Using execjs 2.2.0
Using thor 0.19.1
Using orm_adapter 0.5.0
Using geocoder 1.2.2
Using hike 1.2.3
Using multi_json 1.10.1
Using method_source 0.8.2
Using pg 0.17.1
Using slop 3.4.7
Using bundler 1.6.2
Using tilt 1.4.1
Using sass 3.2.19
Using spring 1.1.3
Using rdoc 4.1.1
Using tzinfo 1.2.1
Using rack-test 0.6.2
Using warden 1.2.3
Using treetop 1.4.15
Using coffee-script 2.2.0
Using uglifier 2.5.1
Using pry 0.9.12.4
Using sprockets 2.11.0
Using sdoc 0.4.0
Using activesupport 4.1.1
Using mail 2.5.4
Using actionview 4.1.1
Using activemodel 4.1.1
Using jbuilder 2.1.0
Using actionpack 4.1.1
Using activerecord 4.1.1
Using actionmailer 4.1.1
Using railties 4.1.1
Using sprockets-rails 2.1.3
Using coffee-rails 4.0.1
Using devise 3.2.4
Using jquery-rails 3.1.0
Using rails 4.1.1
Using sass-rails 4.0.3
Using rMeetup 1.0.1 from git://github.com/tannermares/rmeetup.git (at master)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

我可以清楚地看到寶石被捆綁在一起。 我可以運行其他命令來啟動應用程序和控制台,但無法運行生成遷移。 有關如何解決此問題的任何想法? 我已經嘗試刪除安裝ruby並重新安裝,但這沒有幫助。

我認為Spring是行為不端的,並沒有正確地重新要求寶石。

用料bin/spring status檢查彈簧的bin/spring status 如果它正在運行,請嘗試使用bin/spring stop停止它。 如果不是,請檢查是否有任何孤立的Spring進程可能會搞砸了:

ps aux | grep spring ps aux | grep spring

我不完全確定為什么 Spring會這樣做,但是為了解決這個問題而將其解決了。 我無法再次復制進一步調查。

您可能正在使用錯誤版本的Rails。 使用bundle exec前綴rails命令應該為您排序

rails g migration create_meetups_table

bundle exec rails g migration create_meetups_table

還要將gem添加到Gemfile.rb並運行bundle install,這將確保bundle使用它來執行rails命令時知道正確的gem。

使用RVM或RBENV可能是一個更好的長期解決方案。

https://rvm.io/

https://github.com/sstephenson/rbenv

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM