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: 7

0
votes
answers
74 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

0
votes
answers
68 views
+10

在軌道上安裝寶石,紅寶石。使用JSON錯誤

0

我目前正試圖創建具有軌道新的應用程序,希望在我的應用程序目錄下安裝寶石,得到了以下信息:在軌道上安裝寶石,紅寶石。使用JSON錯誤

[email protected]:/dev/movies-forum# bundle install --path vendor/bundle 
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and 
installing your bundle as root will break this application for all non-root 
users on this machine. 
Fetching gem metadata from https://rubygems.org/........... 
Fetching version metadata from https://rubygems.org/... 
Fetching dependency metadata from https://rubygems.org/.. 
Resolving dependencies.... 
Installing rake 12.3.0 
Installing concurrent-ruby 1.0.5 
Installing json 1.8.6 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/json-1.8.6/ext/json/ext/generator 
/usr/bin/ruby2.3 -r ./siteconf20171125-3993-154eb9h.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/json-1.8.6 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.6/gem_make.out 
Installing minitest 5.10.3 
Installing thread_safe 0.3.6 
Installing builder 3.2.3 
Installing erubis 2.7.0 
Installing mini_portile2 2.3.0 
Installing crass 1.0.3 
Installing rack 1.6.8 
Installing mini_mime 1.0.0 
Installing arel 6.0.4 
Installing debug_inspector 0.0.3 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/debug_inspector-0.0.3/ext/debug_inspector 
/usr/bin/ruby2.3 -r ./siteconf20171125-3993-1n3hl3h.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/debug_inspector-0.0.3 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.3/gem_make.out 
Using bundler 1.11.2 
Installing byebug 9.1.0 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/byebug-9.1.0/ext/byebug 
/usr/bin/ruby2.3 -r ./siteconf20171125-3993-g49k1z.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/byebug-9.1.0 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/byebug-9.1.0/gem_make.out 
Installing coffee-script-source 1.12.2 
Installing execjs 2.7.0 
Installing thor 0.20.0 
Installing ffi 1.9.18 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/ext/ffi_c 
/usr/bin/ruby2.3 -r ./siteconf20171125-3993-yzalv6.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.18/gem_make.out 
Installing multi_json 1.12.2 
Installing rb-fsevent 0.10.2 
Installing rdoc 4.3.0 
Installing tilt 2.0.8 
Installing sqlite3 1.3.13 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3 
/usr/bin/ruby2.3 -r ./siteconf20171125-3993-1y1q30j.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out 
Installing turbolinks-source 5.0.3 
Installing i18n 0.9.1 
An error occurred while installing json (1.8.6), and Bundler cannot continue. 
Make sure that `gem install json -v '1.8.6'` succeeds before bundling. 
[email protected]:/dev/movies-forum# gem install json -v '1.8.6' 
Fetching: json-1.8.6.gem (100%) 
Building native extensions. This could take a while... 
ERROR: Error installing json: 
    ERROR: Failed to build gem native extension. 

    current directory: /var/lib/gems/2.3.0/gems/json-1.8.6/ext/json/ext/generator 
/usr/bin/ruby2.3 -r ./siteconf20171125-4056-c2r6jm.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.6 for inspection. 
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.6/gem_make.out 
[email protected]:/dev/movies-forum# which bundler 
/usr/bin/bundler 
[email protected]:/dev/movies-forum# gem install bundler && rbenv rehash 
Fetching: bundler-1.16.0.gem (100%) 
Successfully installed bundler-1.16.0 
Parsing documentation for bundler-1.16.0 
Installing ri documentation for bundler-1.16.0 
Done installing documentation for bundler after 4 seconds 
1 gem installed 
Program rbenv nie jest obecnie zainstalowany. Mo?esz go zainstalowa? wpisuj?c: 
apt install rbenv 
[email protected]:/dev/movies-forum# bundle install --path vendor/bundle 
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and 
installing your bundle as root will break this application for all non-root 
users on this machine. 
Fetching gem metadata from https://rubygems.org/........... 
Fetching version metadata from https://rubygems.org/... 
Fetching dependency metadata from https://rubygems.org/.. 
Resolving dependencies.... 
Using rake 12.3.0 
Using concurrent-ruby 1.0.5 
Installing json 1.8.6 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/json-1.8.6/ext/json/ext/generator 
/usr/bin/ruby2.3 -r ./siteconf20171125-4146-njwwhh.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/json-1.8.6 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.6/gem_make.out 
Using minitest 5.10.3 
Using thread_safe 0.3.6 
Using builder 3.2.3 
Using erubis 2.7.0 
Using mini_portile2 2.3.0 
Using crass 1.0.3 
Using rack 1.6.8 
Using mini_mime 1.0.0 
Using arel 6.0.4 
Installing debug_inspector 0.0.3 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/debug_inspector-0.0.3/ext/debug_inspector 
/usr/bin/ruby2.3 -r ./siteconf20171125-4146-r39wqa.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/debug_inspector-0.0.3 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.3/gem_make.out 
Using bundler 1.11.2 
Installing byebug 9.1.0 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/byebug-9.1.0/ext/byebug 
/usr/bin/ruby2.3 -r ./siteconf20171125-4146-16t55au.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/byebug-9.1.0 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/byebug-9.1.0/gem_make.out 
Using coffee-script-source 1.12.2 
Using execjs 2.7.0 
Using thor 0.20.0 
Installing ffi 1.9.18 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/ext/ffi_c 
/usr/bin/ruby2.3 -r ./siteconf20171125-4146-ngcier.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.18/gem_make.out 
Using multi_json 1.12.2 
Using rb-fsevent 0.10.2 
Using rdoc 4.3.0 
Using tilt 2.0.8 
Installing sqlite3 1.3.13 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3 
/usr/bin/ruby2.3 -r ./siteconf20171125-4146-9yhg8k.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out 
Using turbolinks-source 5.0.3 
Using i18n 0.9.1 
An error occurred while installing json (1.8.6), and Bundler cannot continue. 
Make sure that `gem install json -v '1.8.6'` succeeds before bundling. 
[email protected]:/dev/movies-forum# 
[email protected]:/dev/movies-forum# gem bundler install 
ERROR: While executing gem ... (Gem::CommandLineError) 
    Unknown command bundler 
[email protected]:/dev/movies-forum# sudo gem install bundler 
Successfully installed bundler-1.16.0 
Parsing documentation for bundler-1.16.0 
Done installing documentation for bundler after 3 seconds 
1 gem installed 
[email protected]:/dev/movies-forum# bundle install --path vendor/bundle 
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and 
installing your bundle as root will break this application for all non-root 
users on this machine. 
Fetching gem metadata from https://rubygems.org/........... 
Fetching version metadata from https://rubygems.org/... 
Fetching dependency metadata from https://rubygems.org/.. 
Resolving dependencies.... 
Using rake 12.3.0 
Using concurrent-ruby 1.0.5 
Installing json 1.8.6 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/json-1.8.6/ext/json/ext/generator 
/usr/bin/ruby2.3 -r ./siteconf20171125-4191-1krkby3.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/json-1.8.6 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.6/gem_make.out 
Using minitest 5.10.3 
Using thread_safe 0.3.6 
Using builder 3.2.3 
Using erubis 2.7.0 
Using mini_portile2 2.3.0 
Using crass 1.0.3 
Using rack 1.6.8 
Using mini_mime 1.0.0 
Using arel 6.0.4 
Installing debug_inspector 0.0.3 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/debug_inspector-0.0.3/ext/debug_inspector 
/usr/bin/ruby2.3 -r ./siteconf20171125-4191-3mbadh.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/debug_inspector-0.0.3 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/debug_inspector-0.0.3/gem_make.out 
Using bundler 1.11.2 
Installing byebug 9.1.0 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/byebug-9.1.0/ext/byebug 
/usr/bin/ruby2.3 -r ./siteconf20171125-4191-1ihoksu.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/byebug-9.1.0 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/byebug-9.1.0/gem_make.out 
Using coffee-script-source 1.12.2 
Using execjs 2.7.0 
Using thor 0.20.0 
Installing ffi 1.9.18 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/ext/ffi_c 
/usr/bin/ruby2.3 -r ./siteconf20171125-4191-ns9wm1.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.18/gem_make.out 
Using multi_json 1.12.2 
Using rb-fsevent 0.10.2 
Using rdoc 4.3.0 
Using tilt 2.0.8 
Installing sqlite3 1.3.13 with native extensions 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3 
/usr/bin/ruby2.3 -r ./siteconf20171125-4191-1hupaig.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /dev/movies-forum/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13 for inspection. 
Results logged to /dev/movies-forum/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out 
Using turbolinks-source 5.0.3 
Using i18n 0.9.1 
An error occurred while installing json (1.8.6), and Bundler cannot continue. 
Make sure that `gem install json -v '1.8.6'` succeeds before bundling. 

顯然,我所做的就是:

[email protected]:/dev/movies-forum# gem install json -v '1.8.6' 
Building native extensions. This could take a while... 
ERROR: Error installing json: 
    ERROR: Failed to build gem native extension. 

    current directory: /var/lib/gems/2.3.0/gems/json-1.8.6/ext/json/ext/generator 
/usr/bin/ruby2.3 -r ./siteconf20171125-4328-ttizdh.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.6 for inspection. 
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.6/gem_make.out 

我應該如何處理所有這些錯誤?我在.../gems中有一個json-1.8.6目錄。我在那裏看到24個其他寶石,但不應該在70左右?我並不是真正的鐵桿專家,這是我的第一次嘗試。

沙发
0
0

這裏就是我沒有和它幫助:

apt-get install ruby-dev 

當我試圖主機一臺服務器有一個與「uglifier」一個問題,但這個幫助:

sudo apt-get install nodejs 
0
votes
answers
57 views
+10

高Sierra 10.13.1和Rails的問題?

0

我已經嘗試在高塞拉利昂安裝Rails,但不斷收到「無法構建gem本機擴展」錯誤。高Sierra 10.13.1和Rails的問題?

checking for sys/epoll.h... no

^這是我需要做什麼來看着。我不確定這是否是新操作系統的問題...可能是nio4r-2.1.0的問題?

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

 
    current directory: /Users/paulkim/.rvm/gems/ruby-2.4.2/gems/nio4r-2.1.0/ext/nio4r 
 
/Users/paulkim/.rvm/rubies/ruby-2.4.2/bin/ruby -r ./siteconf20171203-22631-czj48g.rb extconf.rb 
 
checking for unistd.h... yes 
 
checking for sys/select.h... yes 
 
checking for poll.h... yes 
 
checking for sys/epoll.h... no 
 
checking for sys/event.h... yes 
 
checking for sys/queue.h... yes 
 
checking for port.h... yes 
 
checking for sys/resource.h... yes 
 
creating Makefile 
 

 
current directory: /Users/paulkim/.rvm/gems/ruby-2.4.2/gems/nio4r-2.1.0/ext/nio4r 
 
make "DESTDIR=" clean 
 

 
current directory: /Users/paulkim/.rvm/gems/ruby-2.4.2/gems/nio4r-2.1.0/ext/nio4r 
 
make "DESTDIR=" 
 
compiling bytebuffer.c 
 
compiling monitor.c 
 
compiling nio4r_ext.c 
 
In file included from nio4r_ext.c:7: 
 
./../libev/ev.c:488:48: warning: '/*' within block comment [-Wcomment] 
 
/*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */ 
 
              ^
 
./../libev/ev.c:1068:26: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'unsigned int' [-Wshorten-64-to-32] 
 
    return ecb_popcount32 (x) + ecb_popcount32 (x >> 32);

+0

這只是顯示一些警告 - 沒有什麼應該是致命的。關於sys/epoll.h的行只是信息性的(它檢查哪些功能可用,maoll上不存在epoll) –

+0

是否安裝了Xcode及其開發人員命令行工具?您是否至少打開了一次Xcode並接受了許可證? – spickermann

+0

https://stackoverflow.com/questions/8389301/os-x-rails-failed-to-build-gem-native-extension#12229945和https://stackoverflow.com/questions/9552292/failed-to-build -gem-native-extension –

沙发
0
0

正是有了高塞拉利昂和xCode.I一個問題,第一重新格式化我的機器埃爾卡皮坦,也沒有安裝Rails的問題。然後在另一臺機器與高山我也有問題與Rails。

更新到xCode 9.2後,我成功安裝了Rails 5.1.4。

謝謝大家。

0
votes
answers
96 views
+10

如何從文件中讀取文本到ruby中的數組

0

有沒有辦法將net-ssh gem中的HOST,USER,PASS varibales視爲一個數組,並且有多個值?如何從文件中讀取文本到ruby中的數組

我目前有一個帶有HOST,USER和PASS值的外部文本文件,但是我需要將這些內容傳遞給net-ssh gem中的上述變量。

任何幫助和編輯來澄清問題,我們感謝! :)

沙发
0
1

你應該可以使用splat操作符來做到這一點。請仔細閱讀此內容,但Google很快會返回this介紹。使用此方法,您可以將一組參數傳遞給您描述的方法。喜歡的東西:

some_values = ['host_name', 'user_name', 'password'] 
some_method(*some_values) 

如果你可以更新您的問題,包括一些例如輸入,你試過到目前爲止,與期望的結果,那會是非常方便的進入更多的細節。

我不確定在讀取文件/值之前是否出現問題。如果是這樣,給我看文件格式,我會想一想 - 你可能需要使用像File.read('your_file.txt')這樣的東西。

否則,請考慮將值存儲在YAML文件中,這是用於在鐵路應用程序之外存儲敏感變量的常用模式。藉此,您可以加載文件並以散列形式訪問數據,並作爲參數傳遞。

這有幫助嗎?希望如此 - 如果沒有,請在問題中增加一些細節,我會更新以反映這一點。

+0

感謝您的迴應!我會試試這個。我不熟悉腳本(ruby),所以我的語法可能是另一個問題。讓我嘗試發佈相關代碼 – CreeFC

0
votes
answers
73 views
+10

無法創建色器件

0

使用設備的任務,不能創建任務 我的模型 用戶無法創建色器件

class User < ApplicationRecord 
    # Include default devise modules. Others available are: 
    # :confirmable, :lockable, :timeoutable and :omniauthable 
    devise :database_authenticatable, :registerable, 
     :recoverable, :rememberable, :trackable, :validatable 

    has_many :tasks 
end 

任務

class Task < ApplicationRecord 
    belongs_to :user 
end 

任務控制器

def create 
    @task = Task.new(task_params) 

    respond_to do |format| 
     if @task.save 
     format.html { redirect_to @task, notice: 'Task was successfully created.' } 
     format.json { render :show, status: :created, location: @task } 
     else 
     format.html { render :new } 
     format.json { render json: @task.errors, status: :unprocessable_entity } 
     end 
    end 
    end 

,並試圖在創建任務有錯誤

1錯誤禁止被保存在這個任務:

User must exist 

我的反應

開始POST 「/任務」 爲127.0.0.1,在2017年12月27日14時20分59秒0200 處理由TasksController#創建以HTML 參數:{ 「UTF8」=> 「?」, 「authenticity_token」=> 「b7EkQsJygYBW1xLIm1uFD8jluXy2LYeoYjAOjKcwWOMHLwtalXmkTrNJu0yhexucwY94COegDcuVrOWLRkf8dg ==」, 「任務」=> { 「標題」=> 「」,「描述「=>」「,」優先「=>」「,」due(1i)「=>」2017「,」due(2i)「=>」12「,」due(3i)「=>」27「 ,「完成」=>「0」},「提交」=>「創建任務」}

User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 2], ["LIMIT", 1]] 
    (0.0ms) begin transaction 
    (0.1ms) rollback transaction 

怎麼了?

沙发
0
0

更改belongs_to :userbelongs_to :user, optional: true。 Rails 5引入了關聯中的默認驗證。請參閱this link更好地理解

+0

它的工作原理,但不是正確的。當我添加到new_task_view

<%= form.label :user_id %> <%= form.text_field :user_id, id: :task_done %>
n它的工作原理我whant,但我需要勉強把用戶的ID。我希望自動執行此操作 – asda111sd

板凳
0
0

的方法創建控制器需要添加@task.user_id = current_user.id

+0

這不能提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 - [來自評論](/ review/low-quality-posts/18362806) – Mamun

+0

這是一個答案。它可以使用更多的解釋,但它是一個答案。 –

地板
0
0

要知道,工作是不是按照https://reservedwords.herokuapp.com/words/task?q[word_or_notes_cont]=task

在Rails的模型好名字沒有保留字完整列表因爲語言和框架的性質。但是,當你使用衝突的關鍵字時,有時你會面對奇怪的行爲。

4楼
0
0

你丟失了user_id創建task

嘗試以下

在你的代碼

def create 
    @task = Task.new(task_params) 

    respond_to do |format| 
    if @task.save 
     format.html { redirect_to @task, notice: 'Task was successfully created.' } 
     format.json { render :show, status: :created, location: @task } 
    else 
     format.html { render :new } 
     format.json { render json: @task.errors, status: :unprocessable_entity } 
    end 
    end 
end 

從您的代碼修改,您可以使用

def create 
    @task = Task.new(task_params) 
    @task.user = current_user 

    respond_to do |format| 
    if @task.save 
     format.html { redirect_to @task, notice: 'Task was successfully created.' } 
     format.json { render :show, status: :created, location: @task } 
    else 
     format.html { render :new } 
     format.json { render json: @task.errors, status: :unprocessable_entity } 
    end 
    end 
end 

希望幫助

0
votes
answers
52 views
+10

如何使用ruby線程在類中運行一個方法?

-2

我有一個類和屬性有如何使用ruby線程在類中運行一個方法?

class Person 
    attr_accessor :name 
    def say_hello 
    puts "person name #{self.name} " 
    end 
end 

現在我想執行say_hello但這個線程

queue_thread= [] 
1..100.times do |number| 
    person= Person.new 
    person.name= number.to_s 
    thread_to_run=Thread.new {person.say_hello} 
    queue_thread << thread_to_run 
end 
queue_thread.map {|thread_current| thread_current.join} 

你有一些想法如何做到這一點的方法是什麼?我看和prprmm比線程是不識別對象的實例的變量。

正確的答案應該是這個控制檯

"person name 1" 
"person name 2" 
"person name ..." 
"person name etc" 
+0

你會得到什麼?作爲一個說明,多個線程同時寫入控制檯是一個很好的混合方式。一個線程應該處理輸出。 – tadman

+0

感謝您的回答,我再次編輯,我需要通過控制檯獲取人名1,人名2,人名3。你可以幫我嗎 ? –

+0

如果你需要這個順序,線程會搞砸了。你爲什麼穿線?您需要以某種方式收集輸出並在顯示之前進行排序。 – tadman

沙发
0
0

這段代碼的問題是它火災關閉多個線程調用join之前 - 就在這個時候,一些線程可稱爲由於線程的異步性質,所以順序不正確。

只要線程被調用,一個選項就是簡單地join。這實際上將暫停迭代,直到線程完成,所以你知道他們會留在順序:

100.times do |number| 
    person= Person.new 
    person.name= number.to_s 
    Thread.new {person.say_hello}.join 
end 

注有真的在這裏使用一個線程是沒有意義的,但它至少表明你可以join作品。

另一個選項(也不必要地使用線程)是通過將線程調用存儲爲lambda來延遲線程調用。這是基本相同的事情,但可以讓你它分成兩個迭代:

queue_threads= [] 
1..100.times do |number| 
    person= Person.new 
    person.name= number.to_s 
    thread_lambda = -> { Thread.new {person.say_hello} } 
    queue_threads.push(thread_lambda) 
end 
queue_threads.map {|thread_lambda| thread_lambda.call.join} 

還要注意的是1..100.times沒有做什麼,你認爲它是。這與說100.times是一回事,例如,如果你說99..100.times,99被忽略,它將是100次迭代,而不是1次。如果你想迭代一個範圍,你可以使用像99..100.each do |i|這樣的東西。

0
votes
answers
50 views
+10

Rails:更改will_paginate gem的next_page類

0

是否可以更改將paginate gem的類名'next_page'?例如很容易改變.paginate類,但我不知道,如果一旦你被允許改變封閉類的名稱,改變嵌套類的名稱是不可能性與「next_page」Rails:更改will_paginate gem的next_page類

:class - CSS class name for the generated DIV (default: "pagination") 
:previous_label - default: "« Previous" 
:next_label - default: "Next »" 
:page_links - when false, only previous/next links are rendered (default: true) 
:inner_window - how many links are shown around the current page (default: 4) 
:outer_window - how many links are around the first and the last page (default: 1) 
:link_separator - string separator for page HTML elements (default: single space) 
:param_name - parameter name for page number in URLs (default: :page) 
:params - additional parameters when generating pagination links (eg.    :controller => "foo", :action => nil) 
:renderer - class name, class or instance of a link renderer (default in Rails: WillPaginate::ActionView::LinkRenderer) 
:container - toggles rendering of the DIV container for pagination links, set to false only when you are rendering your own pagination markup (default: true) 
+0

爲什麼你需要改變類名? –

沙发
0
0

是多餘的,因此沒有提供。

使用CSS選擇器.pagination > .next_page來避免任何可能的名稱衝突。

26
votes
answers
72 views
+10

如何安裝cocoapods?

我提到太多鏈接並試過,但沒有成功。如果有人有想法,那麼請與我分享。我閱讀了可可豆莢文件,並多次嘗試安裝,但由於啟動步驟總是失敗。我發現一個錯誤,我無法先安裝寶石。任何人都可以逐一給我這些步驟嗎?如何安裝或演示。

是我試過的一個鏈接。

屏幕截圖是指我給出的此控制台錯誤:

在此輸入圖像描述

沙发
+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
34
votes
answers
28 views
+10

安裝mysql2時出錯:無法構建gem原生擴展

我在嘗試mysql2為Rails 安裝gem 時遇到了一些問題。當我嘗試通過運行安裝它bundle install或gem install mysql2它給我以下錯誤: 安裝mysql2時出錯:錯誤:無法構建gem原生擴展。 我該如何修復並成功安裝mysql2?
沙发
+70

If you are using yum try:

sudo yum install mysql-devel

它適用於基於CentOS的Amazon EC2 Micro Instance。 - 列儂8月30日在20:38

板凳
+50

This solved my problem once in Windows:

subst X: "C:Program filesMySQLMySQL Server 5.5" 
gem install mysql2 -v 0.x.x --platform=ruby -- --with-mysql-dir=X: --with-mysql-lib=X:libopt 
subst X: /D

如果你的lib沒有opt文件夾:gem install mysql2 --platform = ruby​​ - --with-mysql-dir = X: - without-opt-dir - Junior M Mar 21'14 at 19:51

我即將發布消息來源,但我看到用戶Ritesh Kumar已經這樣做了。所以他的優點,不是我的。 - Carlos Pardilla 2011年8月9日1:56

地板
+50

If you are still having trouble….

Try installing

   sudo apt-get install ruby1.9.1-dev
4楼
+40

I had this issue on Windows 7. This is apparently an incompatibility issue and the solution is as follows:

Download the libmySQL.dll file from an older InstantRails installer. It is available from the InstantRails GitHub repo.

Next, copy that file into your Ruby/bin folder.

Now, you are good to go ;)

人力資源管理。:(我試過這個,但在嘗試運行捆綁安裝時仍然出現錯誤。 - Adam 8月8日在20:33

5楼
+30

I got this error too. Solved by installing development packages. I'm using arch and it was:

sudo pacman -S base-devel

which installed:

m4, autoconf, automake, bison, fakeroot, flex, libmpc, ppl, cloog-ppl, elfutils, gcc,
libtool, make, patch, pkg-config

but I think it actually needed make and gcc. Error output said (on my machine, among other):

"You have to install development tools first."

So it was an obvious decision and it helped.

6楼
+30

You have to Install some dependencies

sudo apt-get install libmysql-ruby libmysqlclient-dev
7楼
+30

On Debian Stretch the package that worked for me was default-libmysqlclient-dev

sudo apt-get update && apt-get install -y default-libmysqlclient-dev

8楼
+20

I was running into this error on my mac and found that I needed to upgrade from mysql 32bit to mysql 64 bit to get this error to go away. I was running OSX 10.6 on an intel macbook pro with ruby 1.9.2 and rails3.0.0

I also needed to install xcode in order to get unix utilities like "make" that are required to compile the gem.

once this was done I was able to run gem install mysql and gem install mysql2 without error.

紅寶石1.6.2或紅寶石1._9_.2? - Tim Snowhite 2010年9月20日22:07

ruby 1.9.2編輯了我的回答。謝謝! - lofte 2010年10月16日17:11

9楼
+10

For windows user: You set the lib and include path of your mysql, for instance, if youre using xampp you can have like this:

gem install mysql2 -- '--with-mysql-lib="C:xamppmysqllib" --withmysql-include="C:xamppmysqlinclude"'
10楼
+10

Solution only works on Mac OS X

If you've installed MySQL with homebrew, what worked for me was uninstalling MySQL, and installing MySQL Community Edition via the MySQL website (https://www.mysql.com/).

After installed, just re-enter the command to gem install mysql2 or if necessary, sudo gem install mysql2, if you are getting permission denied problems.

11楼
0

I got the gem built on Mac OS X 10.6.6 by 1) Ensuring the Developer tools package is installed 2) Downloading the current MySQL package (5.5.8 in my case) from Source 3) Installing the cmake tool from cmake.org 4) Following the instructions in section 2.11 of INSTALL-SOURCE from the mysql distribution files 5) sudo gem install mysql2 -- --srcdir=/usr/local/mysql/include The gem built successfully, but there are two errors in the documentation that rdoc and ri complain about. But now when I try to require 'mysql2' I get a

LoadError: no such file to load -- mysql2/mysql2

I was hoping the error I would get was that the libmysqlclient.16.dylib couldn't be found because we figured that out in another post (search for install_name_tool).

My $PATH has /usr/local/mysql in it (that's where my source and built files are located), so I'm a little stumped. If anyone has any thoughts, I'll check back after a few hours of sleep.

12楼
0

If still getting error then follow the steps of mysql2 gem installation on Rails 3 on -

http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html

where most of the user were able to install mysql2 gem.

13楼
0

After you get the mysql-dev issues corrected, you may need to remove the bad mysql2 install. Look carefully at the messages after $ bundle install. You may need to

rm -rf vendor/cache/
rm -rf ./Zentest

This will clear out the bad mysql2 installation so that a final $ bundle install can create a good one.

14楼
0

download the right version of mysqllib.dll then copy it to ruby bin really works for me. Follow this link plases mysql2 gem compiled for wrong mysql client library

15楼
0

Got the "You have to install development tools first." error when trying to install the mysql2 gem after upgrading to Mac OS X Mountain Lion. Apparently doing this upgrade removes the command line compilers.

To fix:

  • I uninstalled my very old version of Xcode (ran the uninstall script in /Developer/Library). Then deleted the /Developer directory.
  • Went to the AppStore and downloaded Xcode.
  • Launched Xcode and went into the Preferences -> Downloads, and installed the command line tools.
16楼
0

You are getting this problem because you have not install MySql. Before install mysql2 gem. Install MySQL. After that mysql2 gem will install.

17楼
0

I just wanted to add this answer specifically for Mac Users.

My server was running perfectly fine until I updated my xcode. The while starting my rails server the error was shown like this

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

    /Users/user/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb --with-mysql-
    checking for rb_thread_blocking_region()... /Users/user/.rvm/rubies/ruby-1.9.3-  
    p448/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an    
    executable file. (RuntimeError)

And there was suggestion to install mysql2 gem at the end of the error message. So when i tried installing it I got the error as above mentioned in this question. The error I got is as follows

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

So as suggested in this post I tried 'brew install mysql' and that quitted saying that mysql version so and so already installed. But there was warning before it saying

Warning: You have not agreed to the Xcode license.
Builds will fail! Agree to the license by opening Xcode.app or running:
xcodebuild -license

Then I tried this sudo xcodebuild -license and type 'agree' at the end. You have to be root to agree to the license.

After this, I again tried bundle install and then everything is working fine as normal. [ Even due to this xcode updation, I had problem with my tower also.]

18楼
0

libmysql-ruby has been phased out and replaced. New command:

 sudo apt-get install ruby-mysql libmysqlclient-dev
19楼
0

For those using Windows 7 and 64-bit MySQL

If you want to use 64-bit MySQL, you should follow the instructions here (also here).

20楼
0

In my case this helped:

$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl/include"

Then:

gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/' -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib

Result:

Building native extensions with: '--with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib'
This could take a while...
Successfully installed mysql2-0.5.2
Parsing documentation for mysql2-0.5.2
Installing ri documentation for mysql2-0.5.2
Done installing documentation for mysql2 after 0 seconds
1 gem installed

See this post.

68
votes
answers
77 views
+10

如何從系統中刪除RVM(Ruby版本管理器)?

如何從系統中刪除RVM(Ruby版本管理器)?
沙发
+280

When using implode and you see:

Psychologist intervened, cancelling implosion, crisis avoided :)

Then you may want to use --force

rvm implode --force

Then remove rvm from following locations:

rm -rf /usr/local/rvm
sudo rm /etc/profile.d/rvm.sh
sudo rm /etc/rvmrc
sudo rm ~/.rvmrc

Check the following files and remove or comment out references to rvm

~/.bashrc 
~/.bash_profile 
~/.profile 
~/.zshrc
~/.zlogin

Comment-out / Remove the following lines from /etc/profile

 source /etc/profile.d/sm.sh
 source /etc/profile.d/rvm.sh

/etc/profile is a readonly file so use

sudo vim /etc/profile

And after making the change write using a bang!

:w!

Finally re-login / restart your terminal.

板凳
+170

In addition to @tadman's answer I removed the wrappers in /usr/local/bin as well as the file /etc/profile.d/rvm.

The wrappers include:

erb
gem
irb
rake
rdoc
ri
ruby
testrb
地板
+70

A lot of people do a common mistake of thinking that 'rvm implode' does it . You need to delete all traces of any .rm files . Also , it will take some manual deletions from root . Make sure , it gets deleted and also all the ruby versions u installed using it .

4楼
+60

Remove the RVM load script from /.bash_rc or /.zsh_rc, then use:

rm -rf /.rvm

Or:

rvm implode
5楼
+40

Run the following command

rvm implode

Now you need to unistall the rvm gem:

gem uninstall rvm

Check if there are any remaining rvm files in your home directory, if yes remove them.

Go to the home directory and list all hidden files

ls -a

rm  .rvm
rm  .rvmrc
6楼
+30

Note that if you installed RVM via apt-get, you have to run some further steps than rvm implode or apt-get remove ruby-rvm to get it to really uninstall.

See "Installing RVM on Ubuntu".

您可以使用與map方法類似的技巧:array.map(&:price).inject(:+) - markquezada 2011年9月8日在2:58

array.map(&:price).inject(0,:+)更安全一些。它確保如果你有一個空列表,你得到0而不是零。 - 約翰夫2011年10月4日9:21

使用array.map(...)。inject(...)是低效的,你將遍歷所有數據兩次。嘗試array.inject(0){| sum,product | sum + = product.price} - everett1992 2013年4月4日6:11

7楼
+20

If you're still getting a env: ruby_executable_hooks: No such file or directory when calling some Ruby package, that means RVM left a little gift for you in your $PATH.

Run the following to find the offending scripts:

grep '#!/usr/bin/env ruby_executable_hooks' /usr/local/bin/*

Then rm all the matches. You'll have to reinstall all of those libraries with an RVM-free gem, of course.

我同意,reduce告訴我更多關於函數的功能,但是注入確實聽起來更酷。 - everett1992 2013年4月4日6:13

同意最後的評論,你給了我最好的答案。 - Jerska 2013年11月11日19:13

我要做的一個評論是在MapReduce之前減少和映射為高階函數。靈感以另一種方式運行。而在MapReduce意義上,它與簡單的功能減少有些不同,對不同機器的通信方式有影響。 - acjay 2015年4月13日14:01

Ken Iverson在編程語言APL中引入了操作符/稱為“簡化運算符”。資料來源:艾弗森,肯尼思。1962年。一種編程語言。威利。另一個來源:“作為思想工具的符號”,1979年ACM圖靈獎演講,Kenneth E. Iverson,dl.acm.org / ft_gateway.cfm?id = 1283935&type = pdf - Fernando Pelliccioni 2016年7月25日1:50

8楼
+10

For other shell newbies trying to fix the PATH variable

After following instructions in accepted answer, check and modify your PATH variable if necessary :

env | grep PATH 

if you see "rvm" anywhere, you need to figure out where you are setting PATH and modify. I was setting it in 3 files - so check all the following files:

vim .bashrc  

Delete the lines in the file referencing rvm using the dd command. :wq to save and exit.
source .bashrc to "reload"

Repeat this process (starting with the vim command) for .profile and .bash_profile

較新版本的activesupport默認情況下不會實際加載所有擴展。您只需要求sum模塊:require'active_support / core_ext / enumerable.rb',或者需要所有主動支持:require'active_support / all'。更多相關信息:API Docs - Dylan Cashman 2012年3月21日20:42

不要緊,activesupport是拖延到項目中從array.inject(:+)到array.sum的大量依賴。 - meagar•2016年2月11日13:29

Nitpick給出了一個好的評論:它應該是'active_support / core_ext / enumerable'而沒有.rb後綴,因為這是隱式添加的。 - Per Lundberg 2016年7月6日14:34