Cucumber environment setup troubleshooting

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

Windows 2008 Server x64 edition中,bundle install时,安装nokogiri gem时遇到如下问题:

Installing nokogiri (1.6.0.rc1)

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

D:/.../ruby/1.9.3-p194/bin/ruby.exe extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help wi
th installing dependencies.
-----
*** 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
...a very long list options
--without-pkg-config


Gem files will remain installed in D:/.../ruby/1.9.3-p194/lib/ruby/gems/
1.9.1/gems/nokogiri-1.6.0.rc1 for inspection.
Results logged to D:/.../ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/nokogi
ri-1.6.0.rc1/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.6.0.rc1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.0.rc1'` succeeds before bundling.

解决方案一:试过直接安装nokogiri,能安装成功。查看Gemfile时发现nokogiri没有对应的版本信息,利用命令gem list nokogiri --remote查找到nokogiri的最新版本为1.5.9,在gemfile里面标明版本信息,然后通过命令gem env找到GEM PATHS,将对应的两个路径下的内容清空,然后输入以下两个命令:gem install bundler; bundle install(要在Gemfile所在路径下运行该命令)
解决方案二&三参考:http://www.cnblogs.com/puresoul/archive/2011/12/01/2270890.html

Scenario A

Using a command prompt, invoke the following command:

SET COMSPEC
If in the output you see something different than cmd.exe as value for that variable, then please adjust it to use cmd.exe

Some tools might change your command processor command, which interferes with Ruby invoking child processes.

Change that and try to install the gem again.

Scenario B

If the problem persist, invoke the following commands in the same command prompt:

REG QUERY "HKCU\Software\Microsoft\Command Processor"
REG QUERY "HKLM\Software\Microsoft\Command Processor"
Execute each line individually. Once you run it, will see something like this:

HKEY_CURRENT_USER\Software\Microsoft\Command Processor
CompletionChar REG_DWORD 0x9
DefaultColor REG_DWORD 0x0
EnableExtensions REG_DWORD 0x1
PathCompletionChar REG_DWORD 0x9
The columns of information are Key, Type and Value. If you see a key named AutoRun, there is a chance this is the culprit of the error you’re receiving.

AutoRun interferes with Ruby messing with child process executing and by result, affecting gem installation. Please remove it with the following command:

REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun
Once you’re done, try opening a new command prompt and executing gem installation again.

但在Windows 2003 Server x64 edition中,bundle install时,安装bigdecimal gem时遇到如下问题:上述3种解决方案都没有起到作用
Installing bigdecimal (1.1.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

D:/.../ruby/1.9.3-p194/bin/ruby.exe extconf.rb
checking for labs() in stdlib.h... *** 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=D:/.../ruby/1.9.3-p194/bin/ruby
D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (Run
timeError)
You have to install development tools first.
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from D:/.../ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
from extconf.rb:3:in `<main>'


Gem files will remain installed in D:/.../ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bigdecimal-1.1.0 for inspection.
Results logged to D:/.../ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bigdecimal-1.1.0/./gem_make.out
An error occurred while installing bigdecimal (1.1.0), and Bundler cannot
continue.
Make sure that `gem install bigdecimal -v '1.1.0'` succeeds before bundling.

解决方案四:确保devkit正确安装。download devkit: http://github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe, unzip the file into C:\devkit, open command prompt, in the command prompt navigate to c:\\devkit, in the command prompt: ruby dk.rb init (this will create config.yml file), open the config file by: notepad config.yml, in the config.yml file, add the line: - C:\Users\supergenius\.yari\ruby-1.8.7-p334-i386-mingw32 ( for help finding ruby, try typing "path" on the command line. ) then input ruby dk.rb install --force (this will dev kit enhance your installed ruby)

2.cannot load such file -- oci8 (LoadError) this error occured when I tried to bundle execute the features.

解决方案:确保Gemfile里面的database组在bundle install时能安装成功。
Installing ruby-oci8 (2.1.5)
oracle odbc相关的环境变量要加上: C:\instantclient_11_2\instantclient-basic-nt-11.2.0.2.0\instantclient_11_2;C:\instantclient_11_2\instantclient-sdk-nt-11.2.0.2.0\instantclient_11_2

3.RubyMine 3.2.4中运行feature文件时出现如下错误,控制台运行feature文件成功:

No tests were found.

Console information:
......
Warning: NLS_LANG is not set. fallback to US7ASCII.
wrong number of arguments (1 for 0) (ArgumentError)
D:/.../ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/cucumber-1.3.1/lib/cucumber/ast/location.rb:22:in `file_colon_line'
......
-e:1:in `load'
-e:1:in `<main>'(DEBUG) Calling CliEnvironment.teardown()
(DEBUG) Not closing the browser in the Debug mode

Empty test suite.

Process finished with exit code 1

Solution:Change RubyMine 3.2.4 to Intellij 12+, disable all plugins during Intellij installation, then Install Ruby(dependency plugin yum will be installed automatically) and Cucumber(Base Cucumber is enough) plugins, then New Project -> Ruby SDK -> No need to select RoR related stuff, then configure the environment variables. Now you can run your feature files! - Difference: in RubyMine, you only need to open the project directory to open the project, no need to do New Project operation.

4. 在Windows 2003 Server x64 Edition中,bundle install时,安装mini_magick时遇到如下问题,检查Gemfile,其中未包含mini_magick:

Installing mini_magick (3.6.0)
Errno::EINVAL: Invalid argument - D:/.../ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mini_magick-3.6.0/test/files/special!
"chars'.gif
An error occurred while installing mini_magick (3.6.0), and Bundler cannot
continue.
Make sure that `gem install mini_magick -v '3.6.0'` succeeds before bundling.

单独安装为以下错误:

D:\cucumber>gem install mini_magick '3.6.0'
ERROR: While executing gem ... (Errno::EINVAL)
Invalid argument - D:/Junit/software/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/mini_magick-3.6.0/test/files/special! "chars'.gif

解决方案:I ran into same problem and here was my solution to work around it. The problem seems to be in the new 3.6.0 version, so back out the new version and install the previous version. gem uninstall mini_magick gem install mini_magick -v 3.5.0 After installing 3.5.0 mini_magick gem, rerun the watir gem install. It should find the mini_magick gem already installed and skip over it and install the remaining gems successfully. Good luck. Actually, this doesn't solve my problems, after installed mini_magick version 3.5.0, I still get the same error when I execute bundle install. I checked the Gemfile.lock file which generated few days ago and found the version for mini_magick is 3.5.0, then i copied Gemfile.lock to Gemfile directory and then executed bundle install, it's successful.

5. 在Windows 2003 Server x64 Edition中,bundle install时,安装bson_ext-1.9.2时遇到如下问题:

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

D:/Dev/software/ruby/1.9.3-p194/bin/ruby.exe extconf.rb
checking for asprintf()... no
checking for ruby/st.h... yes
checking for ruby/regex.h... yes
checking for ruby/encoding.h...
extconf failed, exit code 1

Gem files will remain installed in D:/Dev/software/ruby/1.9.3-p194/lib/ruby/gems/1.9.1
/gems/bson_ext-1.9.2 for inspection.
Results logged to D:/Dev/software/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/extensions/x86-m
ingw32/1.9.1/bson_ext-1.9.2/gem_make.out
An error occurred while installing bson_ext (1.9.2), and Bundler cannot
continue.
Make sure that `gem install bson_ext -v '1.9.2'` succeeds before bundling.
解决方案:单独安装不成功,从stackoverflow中寻找n各解决方案尝试均未解决。终极解决方案:确保devkit成功安装,删掉gems目录下面的bson,bson_ext,单独安装bson,bson_ext成功。

6. 
<未完待续>

posted @ 2013-05-16 17:21  莫笑旧人  阅读(1018)  评论(0编辑  收藏  举报