Unable to install Watir on windows
We have being using ruby and Watir for our automation work, however recently we started facing a new issue. We are unable to install Watir on new machines. We installed ruby 186_27_rc2, then updated gems. Current ‘gem-v’ shows 1.3.7 installed. However when we run ‘gem install watir’, we get error
C:\>gem -v
1.3.7
C:\>gem install watir
Buil开发者_如何学编程ding native extensions. This could take a while…
ERROR: Error installing watir:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb
checking for strncpy_s()… no
creating Makefile
nmake
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
cl -nologo -I. -I. -IC:/Ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2 xg- -G6 -c -Tcwin32/api.c
‘cl’ is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: ‘C:\WINDOWS\system32\cmd.exe’ : return code ’0×1′
Stop.
Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/win32-api-1.4. 8 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/win32-api-1.4.8/ext/gem_make.out
Regards Inder
This might be an error caused by the latest win32-api gem. According to your error message, the C extension source file api.c (which belongs to win32-api, one of Watir's dependencies) is failing to compile, since cl.exe (the command-line MS C++ compiler) is not found:
cl -nologo -I. -I. -IC:/Ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2 xg- -G6 -c -Tcwin32/api.c
‘cl’ is not recognized as an internal or external command, operable program or batch file.
As noted in Iain's answer, this would probably work if you had a copy of cl.exe in your PATH, but you can probably get by without doing that.
Before you "gem install watir", try installing version 1.4.5 of win32-api (which contains prebuilt binaries) with:
gem install win32-api --version 1.4.5
See this thread for a similar situation in early 2010:
http://groups.google.com/group/watir-general/browse_thread/thread/9873479c1a430137
Looks like you're missing a command line tool from your PATH. Try this link: http://www.concept47.com/austin_web_developer_blog/windows/gem-install-error-cl-is-not-recognized-as-an-internal-or-external-command/
精彩评论