Home Php C# Sql C C++ Javascript Python Java Go Android Git Linux Asp.net Django .net Node.js Ios Xcode Cocoa Iphone Mysql Tomcat Mongodb Bash Objective-c Scala Visual-studio Apache Elasticsearch Jar Eclipse Jquery Ruby-on-rails Ruby Rubygems Android-studio Spring Lua Sqlite Emacs Ubuntu Perl Docker Swift Amazon-web-services Svn Html Ajax Xml Java-ee Maven Intellij-idea Rvm Macos Unix Css Ipad Postgresql Css3 Json Windows-server Vue.js Typescript Oracle Hibernate Internet-explorer Github Tensorflow Laravel Symfony Redis Html5 Google-app-engine Nginx Firefox Sqlalchemy Lucene Erlang Flask Vim Solr Webview Facebook Zend-framework Virtualenv Nosql Ide Twitter Safari Flutter Bundle Phonegap Centos Sphinx Actionscript Tornado Register | Login | Edit Tags | New Questions | 繁体 | 简体


10 questions online user: 20

60
votes
answers
54 views
+10

how to make a gemset in RVM the default?

I'm trying to make a gemset the default whenever I start a new terminal in Mac OS X:

rvm use 1.9.3@rails3.2 --create --default

That seems to work, the rails3.2 gemset becomes the current gemset:

$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/me/.rvm/gems/ruby-1.9.3-p0)
   global
=> rails3.2

$

But when I open up a new terminal, the rails3.2 gemset is no longer the current:

$ rvm gemset list

gemsets for ruby-1.9.3-p0 (found in /Users/me/.rvm/gems/ruby-1.9.3-p0)
   global
   rails3.2

$

What do I do?

up vote 48 down vote accepted favorite
沙发
+480
+50

您是否rvm --default use在創建gemset後嘗試指定,因此傳遞:

 rvm --default use ruby-1.9.3-p0@rails3.2

然後看看是否粘?同時使用create和default不是我以前嘗試過的東西,它是唯一讓我覺得不合適的東西。

鑑於下面的討論,我將此作為處理問題的手段。(就我個人而言,我可能會破壞rvm並重新開始。) 但是,如果您想嘗試使用此安裝進行操作,那麼我會查看您的.rvm文件夾,特別是.rvm/environments/default 其中包含導出的所有環境變量默認環境。在這裡,您會發現rvm_gemset_name這可能設置不正確,並且由於某種原因(權限?)沒有更新,或者在這種情況下正確設置了其他一些環境問題。如果不正確,您可以嘗試在文件中手動設置它。

同樣的問題......我運行它並且rvm gemset列表看起來不錯。但後來我打開了一個新的終端選項卡,rails3.2 gemset不再是當前的。- 在。12月14日在18:59

順便說一句,我使用的是ruby-1.9.3-p0@rails3.2,也只是1.9.3@rails3.2,它們的行為都相同 - 在。12月14日'12在19:00

什麼是你的.rvmrc和.profile的rvm? - Mike K. 12月14日在19:01

.rvmrc只包含一個rvm_path環境變量,我沒有.profile - at。12月15日'12在4:56

我用其他一些東西來修改我的答案。希望這可以幫助。 - Mike K. 12月15日在5:13

+60

使用以下命令將gemset設為默認值。

rvm use <ruby version>@<gemset name> --default

例如。

 rvm use 1.8.7-p370@mygemset --default
+60

您可以使用此命令。

rvm use --default <ruby version>@<gemset name>

要么

rvm --default use <ruby version>@<gemset name> 要么

rvm use <ruby version>@<gemset name> --default 

第一個命令對我有用。謝謝。 - cheshireoctopus 2014年4月10日4:13

@cheshireoctopus你是受歡迎的人 - Amrit Dhungana 2014年4月10日4:44

0

有趣的是,沒有人提到rvm別名。嘗試針對特定版本的版本,對我有用:

$ rvm alias create default ruby-2.3.0@rails_4_2_6
# me logs out, fetches another coffee
# me logs in
$ rvm list

rvm rubies

   ruby-2.2.4 [ x86_64 ]
=* ruby-2.3.0 [ x86_64 ]

$ rvm gemset list

gemsets for ruby-2.3.0 (found in /home/aclarke/.rvm/gems/ruby-2.3.0)
   (default)
   global
=> rails_4_2_6
0

rubyracer相關問題也可能來自libv8。要解決此問題:步驟1:運行以下命令以卸載libv8的任何現有安裝:

gem uninstall libv8

運行以下命令安裝rubyracer:

gem install therubyracer -v 0.12.2

通過運行以下命令安裝libv8:

gem install libv8 -v 3.16.14.15 -- --with-system-v8

立即嘗試捆綁安裝:

bundle install
0

您可以使用此命令

$ rvm use rubyversion@gemsetname --create --ruby-version

例如:ruby version = ruby??-2.1.2

gemset name = gem320

這將是

$ rvm use ruby-2.1.2@gem320 --create --ruby-version.

即使您也打開其他選項卡,它也會保留設置。

我做了rvm使用ruby-2.2.3@rails426 --create --ruby-version但是當我打開其他標籤時它仍然沒有保留設置,我得到一個錯誤,說你的Ruby版本是2.2.1,但你的Gemfile指定2.2.3 - vipin8169 2016年3月8日11:04

0
votes
answers
44 views
+10

Rails Tutorial: nokogiri-1.5.2 error on bundle install

After working through the RVM setup, rspec and guard sections of chapter 3 of the Ruby on Rails Tutorial, whenever I run bundle install I get the following error dump:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb 
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:5:in `<main>'


Gem files will remain installed in /home/dan/.bundler/tmp/17577/gems/nokogiri-1.5.2 for inspection.
Results logged to /home/dan/.bundler/tmp/17577/gems/nokogiri-1.5.2/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.5.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.2'` succeeds before bundling.

In the gem_make.out:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb 
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file --mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:5:in `<main>'

I've been debugging for a while now and I think I'm stuck. Help would be GREATLY appreciated!

0
votes
answers
44 views
+10

我正在嘗試在紅寶石中安裝OpenGraph寶石

0

我搜索了整個網絡尋找解決此錯誤的方法。但它不會讓步。根據我的知識,我安裝了所有的庫和依賴項,甚至卸載了ruby和nokogiri並重新安裝。但是這個錯誤仍然存??在。 我正在嘗試在紅寶石中安裝OpenGraph寶石

Gem files will remain installed in /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/nokogiri-1.4.7 for inspection. 
 
Results logged to /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/nokogiri-1.4.7/gem_make.out

這是從這個位置gem_make.out日誌文件 - > /.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/ 2.4.0靜電/引入nokogiri-1.4.7/gem_make.out

ERROR: Error installing opengraph: 
 
	 ERROR: Failed to build gem native extension. 
 

 
    current directory: /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/nokogiri-1.4.7/ext/nokogiri 
 
/home/$User/.rbenv/versions/2.4.2/bin/ruby -r ./siteconf20171125-15877-nibcps.rb extconf.rb --with-nokogiri-dir=/home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/ 
 
*** 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=/home/$User/.rbenv/versions/2.4.2/bin/$(RUBY_BASE_NAME) 
 
extconf.rb:10:in `<main>': uninitialized constant Config (NameError) 
 
Did you mean? RbConfig 
 
       CONFIG 
 

 
extconf failed, exit code 1
我會很感激你,如果你能告訴我什麼是錯的。這是OpenGraph中的錯誤嗎?

P.S:我沒有使用opengraph_parser,因爲它有一個回退方法。我需要opengraph寶石,因爲我需要捕捉異常。

沙发
0
0

它不是opengraph,而是nokogiri。

Nokogiri是opengraph的依賴項。 https://rubygems.org/gems/opengraph/versions/0.0.4

因此,它必須在您的機器上沒有支持nokogiri(libxml2)所需的依賴關係。

安裝你的機器上,這些依賴關係(上於Debian/Ubuntu假設你):

sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev 

的Fedora /紅帽/ CentOS的:

sudo yum install -y gcc ruby-devel zlib-devel 
sudo yum install -y rubygem-nokogiri (alternative) 

然後嘗試通過gem install nokogiri安裝引入nokogiri

對於其他變體或操作系統: http://www.nokogiri.org/tutorials/installing_nokogiri.html

於Fedora 26: 直至另行通知,安裝引入nokogiri版本< 1.8

+0

Hi..thanks的答覆。但我使用的是Fedora 26.你能告訴我Fedora或任何Redhat的類似依賴嗎? – Meimo

+0

@Meimo ruby??-devel zlib-devel。更新了我的答案。 – jemonsanto

+0

感謝您再次回覆,但我試圖安裝這些依賴關係時...終端說「已安裝,無事可做」。看到我告訴你,根據我的知識安裝一切。但它只是不會安裝。我認爲這是一個錯誤。 – Meimo

54
votes
answers
42 views
+10

How do I get a list of files that have been `required` in Ruby?

This is purely an experiment, but I'm wondering if it's possible to get a list of the require'd gems at runtime via some kind of metaprogramming. For example, say I have:

require 'rubygems'
require 'sinatra'
require 'nokogiri'

# don't know what to do here

How can I print out the following at runtime?

this app needs rubygems, sinatra, nokogiri
up vote 30 down vote accepted favorite
沙发
+300
+50

你不能完全這樣做,因為要求一個文件可能需要其他文件,而Ruby無法區分需要的文件和其他人所需的文件。

您可以查看$LOADED_FEATURES所需的每件事物的清單。但是,如果要明確指定依賴項,則應使用Bundler

這是猜測寶石名稱並列舉所有內容的完全不完美的方法:

ruby-1.9.2-p180 :001 > $LOADED_FEATURES.
   select { |feature| feature.include? 'gems' }.
   map { |feature| File.dirname(feature) }.
   map { |feature| feature.split('/').last }.
   uniq.sort
 => ["1.9.1", "action_dispatch", "action_pack", "action_view", "actions", "active_model", "active_record", "active_support", "addressable", "agent", "array", "aws", "builder", "bundler", "cache_stores", "cancan", "cdn", "class", "client", "common", "compute", "connection", "control", "controllers", "core", "core_ext", "core_extensions", "css", "data_mapper", "decorators", "dependencies", "dependency_detection", "deprecation", "devise", "digest", "dns", "encodings", "encryptor", "engine", "errors", "excon", "ext", "failure", "faraday", "fields", "fog", "formatador", "geographer", "haml", "hash", "helpers", "heroku_san", "hmac", "hooks", "hoptoad_notifier", "html", "http", "i18n", "idna", "importers", "inflector", "initializers", "instrumentation", "integrations", "interpolate", "interval_skip_list", "jquery-rails", "json", "kaminari", "kernel", "lib", "mail", "metric_parser", "mime", "mixins", "model_adapters", "models", "module", "mongo_mapper", "mongoid", "multibyte", "new_relic", "node", "nokogiri", "numeric", "oauth", "object", "omniauth", "orm_adapter", "package", "parser", "parsers", "plugin", "pp", "providers", "queued", "rack", "rails", "railtie", "redis", "request", "request_proxy", "resp    ruby-1.9.2-p180 :008 >onse", "resque", "retriever_methods", "routing", "ruby_extensions", "ruby_flipper", "rubygems", "runtime", "samplers", "sass", "sax", "script", "scss", "selector", "sequel", "ses", "shell", "signature", "simple_geo", "state_machine", "stats_engine", "storage", "strategies", "string", "tar_reader", "template", "terremark", "thor", "tokens", "tree", "treetop", "twitter", "us", "util", "vendor", "version_specific", "visitors", "warden", "xml", "xml_mini", "xpath", "xslt"] 
+240

這是獲取所有要求的所有調用的方法。創建此文件:show_requires.rb

alias :orig_require :require
def require s
  print "Requires #{s}
" if orig_require(s)
end

然後啟動你的應用程序

ruby -r show_requires.rb myapp.rb

這會產生類似於:

C:code	est>ruby -r show_requires.rb test.rb
Requires stringio
Requires yaml/error
Requires syck
Requires yaml/ypath
Requires yaml/basenode
Requires yaml/syck
Requires yaml/tag
Requires yaml/stream
Requires yaml/constants
Requires date/format
Requires date
Requires yaml/rubytypes
Requires yaml/types
Requires yaml
Requires etc
Requires dl
Requires rbreadline
Requires readline

如果只需要頂級需求,請添加全局以跟踪嵌套級別:

$_rq_lvl = 0
alias :orig_require :require
def require s
  $_rq_lvl+=1
  print "Requires #{s}
" if orig_require(s) and $_rq_lvl == 1
  $_rq_lvl -=1
end

然後你得到:

C:code	est>ruby -r require_test.rb test.rb
Requires yaml
Requires readline
26
votes
answers
42 views
+10

How to install cocoapods?

I referred too many links and tried, but had no success. If any one has an idea then please please share with me. I read cocoa pods documents and many times tried to install but always failed because of the starting steps. I found one error whereby I can't install gems first. Can anyone give me the steps one by one? How to install or demo.

This is one link which I tried.

The screen shot refers to this console error I was given:

enter image description here

沙发
+70

Pod Installation giving error on OS X El Capitan 10.11.2

ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.

enter image description here

After getting this error tried this command and install again its work for me.

sudo gem install activesupport -v 4.2.6

Now try same pod installation command

sudo gem install -n /usr/local/bin cocoapods

Hope it'll help to all of us.

板凳
+50

For me, the easiest way was to install via ruby gem

sudo gem install cocoapods -v

Please note -v for verbose. It takes while to install cocoapods and often you get confused if it's really happening.

地板
+40

Pod File Install Steps

sudo gem install -n /usr/local/bin cocoapods

pod setup

cd ~/Path/To/Folder/Containing/ShowTracker


touch podfile
open -a Xcode Podfile // TO OPEN IT IN XCODE 
OPEN -e podfile   // TO OPEN IT IN TEXT EDITOR
pod install  // TO INSTALL A NEW POD
pod update // TO UPDATE ALL PODS
4楼
+40

Normally we use

sudo gem install cocoapods

Solution, fix for Cocoapods error on El Capitan 10.11:

sudo gem install -n /usr/local/bin cocoapods
pod setup
cd /project path
pod init

In Podfile we need to set target

# Podfile

platform :ios, '9.0'

use_frameworks!

# My other pods

target “Projectname” do

    pod 'MBProgressHUD', '~> 0.8'
    pod 'Reachability', '~> 3.1.1'
    pod 'AFNetworking', '~> 2.2'
    pod 'TPKeyboardAvoiding', '~> 1.2'

end

target 'ProjectnameTests' do
    testing_pods
end

target 'ProjectnameUITests' do
    testing_pods
end

in console - terminal

pod install
5楼
+20

cocoapod on terminal follow this:

sudo gem update

sudo gem install cocoapods

pod setup

cd (project direct drag link) 

pod init

open -aXcode podfile (if its already open add your pod file name ex:alamofire4.3)

pod install

pod update
6楼
+10
  1. Open Terminal
  2. Enter $ sudo gem install cocoapods command in terminal
  3. Create new Xcode project
  4. Navigate to directory containing Xcode project. Use cd “../directory-location/..” or cd [drag-and-drop project folder]
  5. Pod install

Screenshot for steps

If this prompts error Unable to add a source with url.. then install command line tool for Xcode. Again, rerun Pod install command.

This will install all dependencies as well.

Now, open your project in Workspace i.e. Project-Name.xcworkspace rather than Project-Name.xcodeproj

7楼
+10

cocoa pod installation step :

Open Your Terminal :

sudo gem update --system

sudo gem install activesupport -v 4.2.6

sudo gem install cocoapods

pod setup

pod setup --verbose

Then Go To Your Project Directory with Terminal

cd Your Project Path

Then Enter below command in Terminal

pod init

open -a Xcode Podfile

[Edit POD file with pod ‘libname’ ]

pod install
8楼
+10

If you want to install CocoaPods first time for your project.

Example :Here we will install "Alamofire" sdk using cocoa pods step by step.

Step 1. Open Terminal and hit command and then press “Enter” key

sudo gem install cocoapods

Step 2. If it asks, you should provide system password and then press “Enter” key

Step 3. With command “cd” and give the path of your project and then press “Enter” key

Note : type "cd" command then space and drag project folder to the terminal it will take project path as shown below (Here my project name is : Simple Alamofire)

cd /Users/ramdhanchoudhary/Documents/Swift Workspace/Simple Alamofire

enter image description here

Step 4. Create a pod file in your project by terminal by command “touch Podfile” and press “Enter”

touch Podfile

Step 5. Then, open “Podfile” by terminal command “open Podfile” and press “Enter”

open Podfile

Step 6. Now type following code in opened pod file then save and close file

source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '10.0'
    use_frameworks!

    target '<Your Target Name>' do
            pod 'Alamofire', '~> 4.0'
    end

Step 7. Back in Terminal type command “Pod install” and then press “Enter” Key.

Pod install

Step 8. Wait for the install to get complete 100% its around 650+ MB

Step 9. That's it goto project folder and open below file

.xcworkspace

Step 10. Import Alamofire class and use!!

import Alamofire

9楼
+10

Thanks to SwiftBoy's 10-step solution I successfully used CocoaPods to setup the latest version of AudioKit.

1. Using Xcode create MyAudioApp Swift project saving it to my Developer directory e.g.

    /Users/me/Developer/MyAudioApp

2. Using Cocoapods install AudioKit within MyAudioApp project (i.e. install AudioKit sdk)

3. Open Terminal, type command below and press Enter

    sudo gem install -n /usr/local/bin cocoapods

4. Provide system password and press Enter

5. In Terminal, type command below and press Enter

    cd /Users/me/Developer/MyAudioApp

6. Create project pod file - in Terminal type command below and press Enter

    touch Podfile

7. Open project pod file - in Terminal type command below and press Enter (opens in TextEdit)

    open Podfile

8. Edit code below into open pod file (and save file before quitting TextEdit)

    source 'https://github.com/CocoaPods/Specs.git'
        platform :ios, '12.2'
        use_frameworks!

        target 'MyAudioApp' do
        pod 'AudioKit', '~> 4.7'
    end

9. To install AudioKit in MyAudioApp workspace type Terminal command below and press Enter

    Pod install     

and wait for install to finish

10. In Finder, go to project folder /Users/me/Developer/MyAudioApp and click .xcworkspace file below (opens in Xcode!)

    /Users/me/Developer/MyAudioApp/MyAudioApp.xcworkspace

11. In MyAudioApp edit ViewController.swift and insert the following

    import AudioKit 
10楼
0

Are you behind a proxy? If so, pass the proxy as an argument sudo gem install --http-proxy http://user:password@www-proxy.example.com:80 cocoapods `

11楼
0

Check this

gem install -p http://proxy_ip:proxy_port compass

You might need to add your user name and password to it:

gem install -p http://[username]:[password]@proxy_ip:proxy_port compass

and check this link it may help you

12楼
0

FOR EL CAPITAN

rvm install ruby-2.2.2.

rvm use ruby-2.2.2.

sudo gem install -n /usr/local/bin cocoapods

13楼
0

You can install cocoapods via brew in mac os.

first, open your terminal,

run this code (for install homebrew if you have not):

     ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

then install homebrew easily via this command:

brew install cocoapods
20
votes
answers
24 views
+10

Rubygems: How do I add platform-specific dependency?

I've a ruby gem that has different dependencies for each OS. I have to explicitly write all of them down:

On Mac OS X:

gem install livereload

on Linux:

gem install rb-inotify livereload

on Windows:

gem install eventmachine-win32 win32-changenotify win32-event livereload

Can I tweak a gemspec a bit so installation instructions would look like plain gem install livereload for every OS?

up vote 20 down vote accepted favorite
沙发
+200
+50

這裡概述執行此操作的正確方法由於gemspec是在打包時評估的,因此您需要在本機擴展中進行評估。不要擔心,它不是那麼可怕,因為它仍然只是Ruby代碼(不編譯C或任何東西)。

我們目前正在將這種方法用於OpenShift的一些客戶端工具(源代碼)然後在你的gemspec / Rakefile中,你可以添加一個擴展名,而不是添加依賴項。請注意,需要為此命名文件ext/mkrf_conf.rb才能生效。

66
votes
answers
24 views
+10

Ruby: problem installing EventMachine under Windows 7

I am trying to install the gem EventMachine on Windows 7 (using Ruby 1.9.2 with RubyInstaller) via bundle, but I get the following error. I also installed DevKit and it is working, but I still can't figure out what the problem is:

Installing eventmachine (0.12.10) with native extensions C:/Ruby192/lib/ruby/site_ruby/1.9
.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to bu
ild gem native extension. (Gem::Installer::ExtensionBuildError)

        C:/Ruby192/bin/ruby.exe extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
checking for main() in -lssl... no
creating Makefile

make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_rubyeventmachine'"  > rubyeventmachine-i386-
mingw32.def
g++ -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1.9.1/ruby/
backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_RE
GION -DHAVE_TBR -DHAVE_RB_THREAD_CHECK_INTS -DHAVE_RB_TIME_NEW -DOS_WIN32 -DHAVE_WINDOWS_H
 -DHAVE_WINSOCK_H -DWITHOUT_SSL -DHAVE_MAKE_PAIR    -O3 -g -Wextra -Wno-unused-parameter -
Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-
long   -o binder.o -c binder.cpp
In file included from project.h:137:0,
                 from binder.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
                 from binder.cpp:20:
em.h:91:47: warning: type qualifiers ignored on function return type
em.h:92:76: warning: type qualifiers ignored on function return type
em.h:93:56: warning: type qualifiers ignored on function return type
em.h:95:57: warning: type qualifiers ignored on function return type
em.h:96:60: warning: type qualifiers ignored on function return type
em.h:97:58: warning: type qualifiers ignored on function return type
em.h:98:55: warning: type qualifiers ignored on function return type
em.h:99:36: warning: type qualifiers ignored on function return type
em.h:101:47: warning: type qualifiers ignored on function return type
em.h:106:42: warning: type qualifiers ignored on function return type
em.h:123:45: warning: type qualifiers ignored on function return type
em.h:132:36: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from binder.cpp:20:
eventmachine.h:45:61: warning: type qualifiers ignored on function return type
eventmachine.h:46:112: warning: type qualifiers ignored on function return type
eventmachine.h:47:69: warning: type qualifiers ignored on function return type
eventmachine.h:49:73: warning: type qualifiers ignored on function return type
eventmachine.h:62:75: warning: type qualifiers ignored on function return type
eventmachine.h:63:74: warning: type qualifiers ignored on function return type
eventmachine.h:64:77: warning: type qualifiers ignored on function return type
eventmachine.h:65:41: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from binder.cpp:20:
eventmachine.h:99:60: warning: type qualifiers ignored on function return type
eventmachine.h:100:58: warning: type qualifiers ignored on function return type
eventmachine.h:102:60: warning: type qualifiers ignored on function return type
eventmachine.h:105:41: warning: type qualifiers ignored on function return type
g++ -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1.9.1/ruby/
backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_RE
GION -DHAVE_TBR -DHAVE_RB_THREAD_CHECK_INTS -DHAVE_RB_TIME_NEW -DOS_WIN32 -DHAVE_WINDOWS_H
 -DHAVE_WINSOCK_H -DWITHOUT_SSL -DHAVE_MAKE_PAIR    -O3 -g -Wextra -Wno-unused-parameter -
Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-
long   -o cmain.o -c cmain.cpp
In file included from project.h:137:0,
                 from cmain.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
                 from cmain.cpp:20:
em.h:91:47: warning: type qualifiers ignored on function return type
em.h:92:76: warning: type qualifiers ignored on function return type
em.h:93:56: warning: type qualifiers ignored on function return type
em.h:95:57: warning: type qualifiers ignored on function return type
em.h:96:60: warning: type qualifiers ignored on function return type
em.h:97:58: warning: type qualifiers ignored on function return type
em.h:98:55: warning: type qualifiers ignored on function return type
em.h:99:36: warning: type qualifiers ignored on function return type
em.h:101:47: warning: type qualifiers ignored on function return type
em.h:106:42: warning: type qualifiers ignored on function return type
em.h:123:45: warning: type qualifiers ignored on function return type
em.h:132:36: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from cmain.cpp:20:
eventmachine.h:45:61: warning: type qualifiers ignored on function return type
eventmachine.h:46:112: warning: type qualifiers ignored on function return type
eventmachine.h:47:69: warning: type qualifiers ignored on function return type
eventmachine.h:49:73: warning: type qualifiers ignored on function return type
eventmachine.h:62:75: warning: type qualifiers ignored on function return type
eventmachine.h:63:74: warning: type qualifiers ignored on function return type
eventmachine.h:64:77: warning: type qualifiers ignored on function return type
eventmachine.h:65:41: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
                 from cmain.cpp:20:
eventmachine.h:99:60: warning: type qualifiers ignored on function return type
eventmachine.h:100:58: warning: type qualifiers ignored on function return type
eventmachine.h:102:60: warning: type qualifiers ignored on function return type
eventmachine.h:105:41: warning: type qualifiers ignored on function return type
cmain.cpp:98:71: warning: type qualifiers ignored on function return type
cmain.cpp:109:122: warning: type qualifiers ignored on function return type
cmain.cpp:119:79: warning: type qualifiers ignored on function return type
cmain.cpp:129:83: warning: type qualifiers ignored on function return type
cmain.cpp:260:85: warning: type qualifiers ignored on function return type
cmain.cpp:270:84: warning: type qualifiers ignored on function return type
cmain.cpp:280:88: warning: type qualifiers ignored on function return type
cmain.cpp:290:51: warning: type qualifiers ignored on function return type
cmain.cpp:300:70: warning: type qualifiers ignored on function return type
cmain.cpp:320:55: warning: type qualifiers ignored on function return type
cmain.cpp:546:70: warning: type qualifiers ignored on function return type
cmain.cpp:669:68: warning: type qualifiers ignored on function return type
cmain.cpp: In function 'int evma_send_file_data_to_connection(long unsigned int, const cha
r*)':
cmain.cpp:752:6: error: cannot convert 'stat*' to '_stati64*' for argument '2' to 'int _fs
tati64(int, _stati64*)'
make: *** [cmain.o] Error 1


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.1
0 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.ou
t
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `block in bu
ild_extensions'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `each'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `build_exten
sions'
        from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/source.rb:101:
in `block in install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integ
ration.rb:78:in `preserve_paths'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/source.rb:91:i
n `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:5
8:in `block (2 levels) in run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/rubygems_integ
ration.rb:93:in `with_build_args'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:5
7:in `block in run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12
:in `block in each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12
:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12
:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:4
9:in `run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/installer.rb:8
:in `install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in
`install'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vendor/thor/ta
sk.rb:22:in `run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vendor/thor/in
vocation.rb:118:in `invoke_task'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb
:246:in `dispatch'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vendor/thor/ba
se.rb:389:in `start'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/bin/bundle:13:in `<top (re
quired)>'
        from C:/Ruby192/bin/bundle:19:in `load'
        from C:/Ruby192/bin/bundle:19:in `<main>'

Thanks a lot in advance!

up vote 48 down vote accepted favorite
沙发
+480
+50

已知EventMachine 0.12.10在Windows上的Ruby 1.9.2下無法運行。

請嘗試最新的1.x預發布版本:

gem install eventmachine --pre

如果您使用Thin,最新版本的Thin可以正常使用。

這已在RubyInstaller小組上多次討論過

在rails中需要Thin Gemfile會導致Bundler安裝EventMachine 0.12.10 gem。有什麼方法可以糾正嗎? - aaandre於2012年1月28日1:16

@aaandre:首先安裝gem,然後將它們添加到bundler並進行bundle check而不是bundle update。您還可以強制將eventmachine pre依賴項添加到精簡版之前的gemfile中。 - Luis Lavena 12年1月30日13:37

+120

因為我使用薄。在我的gemfile中,我把:

gem "thin", "1.3.1"
gem "eventmachine", "1.0.0.rc.1"
+60

我更改了gemfile並在其中包含了eventmachine(1.0.0.beta.2)版本,現在它的工作文件。

是的,但我沒有使用eventmachine本身,它只是另一個寶石(我不知道哪一個)依賴它 - noloman 2011年8月31日0:23

6
votes
answers
39 views
+10

Is there a public rubygems.org mirror? [closed]

Is there a working public mirror for http://rubygems.org? It's not working now for me, http://isup.me/rubygems.org says that it doesn't work too.

沙发
+60
+50

RedHat OpenShift provides own RubyGems mirror: http://mirror.ops.rhcloud.com/mirror/ruby/

現在對我不起作用。我被禁止了403。 - Tyler Collier 2013年10月15日2:51

是的,如果您嘗試在瀏覽器中打開URL,則會收到403錯誤。但是如果你創建一個帶有第一行源'http://mirror1.prod.rhcloud.com/mirror/ruby/'的Gemfile,它就會像魅力一樣工作。 - user1569115 2013年10月20日18:41

非常感謝。由於一些DNS問題,rubygems不適合我,但這個鏡子像微風一樣 - ganeshran 2014年2月20日15:57

該URL似乎不再起作用了,但是這個URL確實如此:http://mirror.ops.rhcloud.com/mirror/ruby/ - Pedro Rodrigues 2014年12月2日在1:08

生命保護。DNSIMPLE DDOS正在破壞rubygems。 - 格雷格14年2月2日2:52

49
votes
answers
53 views
+10

Why do I get a bcrypt-ruby gem install error?

Getting an error when trying to install the gem devise, the installation is stopping on the gem bcrypt-ruby:

$ gem install bcrypt-ruby
Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.

I'm running OSX 10.6.7 with Ruby under RVM. I reinstalled the lastest version of xcode & reinstalled Ruby 64bit, Rails and all the gems.

沙发
+300

我在OSX 10.7.3下安裝時遇到了同樣的問題。安裝gem時,我的錯誤信息是:

Building native extensions.  This could take a while...
ERROR:  Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.

creating Makefile

make
compiling bcrypt_ext.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [bcrypt_ext.o] Error 1

看起來寶石正在尋找gcc-4.2,但我只有一個名為gcc的文件。現在,因為我剛剛安裝了最新的Xcode(4.3),我知道我的C編譯器是兼容的,但是gem已經將gcc-4.2硬編碼到其中。所以我的解決方案是:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

鏈接就像一個魅力。

板凳
+60

看起來這裡可能缺少一些信息 - 對我來說,這是由於gcc的brew安裝。gcc在/ usr / bin中,但不是gcc-4.2。所以我只是做了以下事情:

$ cd /usr/bin
$ sudo ln -s gcc gcc-4.2

它創建了一個鏈接,gcc-4.2寶石正在尋找可以追溯的鏈接gcc

希望有所幫助。

地板
+50

它需要在安裝bcrypt-ruby之前安裝ruby-dev。如果您使用的是Ubuntu,請運行

sudo apt-get install ruby1.9.1-dev

要么

sudo apt-get install ruby1.8-dev

基於RUby版本。

4楼
+20

我正在使用RVM,每當安裝帶有原生擴展的gems時,我都會遇到這個問題(bcrypt-ruby,bson-ext,json,eventmachine,nokogiri,linecache19等)

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

只有這樣我才能最終解決問題的方法是卸載然後重新安裝ruby。

rvm remove 1.9.2

rvm install 1.9.2

感謝來自@doublebee的提示:https//github.com/flori/json/issues/78#issuecomment-1499920

5楼
+20

你只需要使用rvm(ruby版本管理器)

rvm uninstall 1.9.3

然後

rvm install 1.9.3

看起來這個錯誤是在rvm 1.9.3的構建上,但卸載和重新安裝修復了bcrypt-ruby 3.0.1的問題

6楼
+20

sudo apt-get install ruby??1.9.1-dev

給我帶來了魅力!非常感謝

感謝您回答第一部分。那問題的第二部分:還有什麼應該用在哪里以及遵循這種方式的好處?什麼是最佳做法? - JVK於2012年8月25日22:42

@JVK參考這篇文章了解更多細節。stackoverflow.com/questions/9265213/...。 - Mukesh Singh Rathaur於2014年1月20日13:25

7楼
+10

好吧,它適用於Mac OS 10.6.7上的RVM下的Ruby 1.9.2:

$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]

$ gem install bcrypt-ruby
Fetching: bcrypt-ruby-2.1.4.gem (100%)
Building native extensions.  This could take a while...
Successfully installed bcrypt-ruby-2.1.4
1 gem installed
Installing ri documentation for bcrypt-ruby-2.1.4...
Installing RDoc documentation for bcrypt-ruby-2.1.4...

試著rvm notes看它是否說你需要安裝任何東西。

8楼
+10

如果您使用的是版本1.8,則bcrypt所需的軟件包位於開發軟件包中。嘗試使用

$sudo apt-get install ruby1.8-dev

然後

$gem install bcrypt-ruby 

問題是關於OSX。 - yfeldblum 2011年10月4日19:14

9楼
0

這個修復工作對我來說在osx上的ubuntu使用自製程序,macports無論如何:

sudo apt-get install ruby1.9.1-dev
10楼
0

我想你需要重新安裝bundler gem。

gem install bundler 然後 bundle install

69
votes
answers
46 views
+10

Unable to update gems on production server

Can not update gems on production server.

I've tried bundle install --deployment and bundle install --without development test

But keep getting:

You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

If this is a development machine, remove the Gemfile freeze 
by running `bundle install --no-deployment

EDIT

I don't know if this is correct, but needed a quick fix. I ran bundle install --no-deployment then bundle update then ran bundle install --deployment again

up vote 46 down vote accepted favorite
沙发
+460
+50

說明可能有點令人困惑。它說你已經修改Gemfile了你的開發機器,只是推動了這些更改,而不是bundle install在提交更改之前運行

通過運行,bundle install您將更新您的Gemfile.lock文件。這應該推送到你的服務器,因為它比它更重要Gemfile考慮文件Gemfile的計劃Gemfile.lock

永遠記得:

  1. 運行bundle install如果你改變了Gemfile,甚至只是為了確保。如果它太慢,則--local通過會強制它僅使用本地gem來解析其依賴關係。
  2. 提交雙方GemfileGemfile.lock文件到你的資料庫
  3. 部署GemfileGemfile.lock生成服務器以確保它們運行與開發環境完全相同的依賴項。

bundle update單獨運行可能會被視為危險,它將更新應用程序的所有依賴項。如果您沒有指定固定版本號,那麼這主要是危險的Gemfile在這裡寫了這篇文章。

+90

FWIW我有這個問題,並通過從我的Gemfile中刪除一些條件語句(OS上的條件)並重新運行bundle來修復它。

是的,我也是。問題解決了。謝謝! - fisherwebdev 12年12月14日9:34

你能用條件陳述解釋你的意思嗎 - 貝西於2015年3月26日12:17

+70

僅供參考:如果您使用這樣的源塊,也可能會出現此錯誤:

source 'https://rails-assets.org' do
  gem 'rails-assets-jquery'
end

你會在Gemfile.lock中看到這個gem的感嘆號:

  rails-assets-jquery!

只需正常定義其他來源,即

source 'https://rails-assets.org'
gem 'rails-assets-jquery'

(順便提一下這里關於使用多個寶石來源。)

根據提到的文章使用非塊版本的源是不安全的。有沒有辦法使用塊版本? - 貝西於2015年3月26日12:23

@Besi我不知道,但Bundler應該發出警告。當它發生時,我計劃在有問題的gem上添加explicit:source選項。 - 吉姆洪水2015年3月26日15:34

如果您正在閱讀本文並想知道發生了什麼。我的生產服務器系統ruby仍然是1.9.3,帶有過時的捆綁版本。當使用source作為塊或gem上的鍵時,我收到此錯誤。通過將其定義為額外的來源,我擺脫了Jim Flood提到的感嘆號,並且部署成功了。我假設舊版本的bundler根本無法處理源塊或源哈希表示法。 - 2015年6月9日17:50,tolgap

使用源塊解決此問題的另一種(可能更好的方法)是確保您的bundler版本在dev / prod服務器之間同步。我在開發盒上運行bundler 1.7.7時遇到此問題,在生產服務器上運行1.7.1。將兩者都更新到1.10.4解決了問題。 - KenB 2015年6月17日14:19

+30

這可能是由您正在部署的服務器上的舊版本的bundler gem引起的(在本例中為生產)。登錄到服務器並運行gem update bundler解決了我的問題。我部署的服務器運行的是1.7.4版本,當前版本是1.9。

+20

我的生產服務器仍然使用舊版本的gem時出現問題,即使Gemfile.lock顯示正確的更新版本。我的生產服務器在Unicorn上運行 - 並且關閉/重新啟動它再次修復了問題 - 而不是發送HUP信號,它確實解決了所有問題。

謝謝你的提示。正是我的問題也是如此。 - toxaq 12年6月20日11:09

哇。我花了最後一次錯誤嘗試了與你的相同的情況(舊寶石)。我希望我早點嘗試過。謝謝! - Tyler Collier 2013年6月18日1:52

+10

由於osx上的mysql-gem,我的“開發”機器上的bundle安裝失敗了...

我還需要快速修復。所以我將repo克隆到生產機器上的一個新文件夾,在那裡運行“bundle install”並將Gemfile.lock提交到repo。

這樣的東西讓我真的討厭捆綁者 - 凱文於2012年8月16日5:18

+10

我有這個問題(Ubuntu 12.10和12.04,其中一個代理服務器)。我的問題是我git://在Gemfile中有一些協議。更改此項以http://幫助我完成所有工作。