2013-01-05 26 views
2

我無法在cygwin環境中使用PhantomJS和CasperJS。我對cygwin非常陌生。我能夠下載Windows的兩個軟件包並通過Windows cmd運行它們。如何獲得Cygwin的PhantomJS/CasperJS?

爲了讓他們與Cygwin的工作,我試過如下:

我下載焦油/ ZIP文件都PhantomJS和CasperJS,我複製了內容上的「bin」文件夾到C:\ cygwin的\完事。但是,當我在phantomjs在Cygwin上鍵入我得到:

/usr/bin/phantomjs: cannot execute binary file

於是,我試圖做的:

pip install git+git://github.com/ariya/phantomjs

而是在等待了一段時間,我得到如下回應後:

Downloading/unpacking git+git://github.com/ariya/phantomjs Cloning git://github.com/ariya/phantomjs to /tmp/pip-dCF1oZ-build Running setup.py egg_info for package from git+git://github.com/ariya/phantomjs Traceback (most recent call last): File "", line 16, in IOError: [Errno 2] No such file or directory: '/tmp/pip-dCF1oZ-build/setup.py' Complete output from command python setup.py egg_info: Traceback (most recent call last):

File "", line 16, in

IOError: [Errno 2] No such file or directory: '/tmp/pip-dCF1oZ-build/setup.py'

---------------------------------------- Command python setup.py egg_info failed with error code 1 in /tmp/pip-dCF1oZ-build Storing complete log in /home/tkondapalli/.pip/pip.log

有沒有人有任何建議如何得到這個工作?有沒有人在cygwin環境中使用PhantomJS/CasperJS?


另外,我還以爲我下載.exe和複製到C:\ Cygwin的\ bin目錄是一個用於Linux,所以也許不工作?因此,這意味着我需要在Cygwin上源代碼編譯...

於是,我開始跟隨建築phantomjs方向:http://phantomjs.org/build.html

我們需要做的第一件事是建立OpenSSL,以便devel的,但我再次不知道如何爲cygwin做到這一點!所以我現在就跳過這一步,這可能是不對的。

我沒有從github下載源代碼並試圖構建它。它沒有與後續的錯誤:

Makefile:217: recipe for target `qtemporaryfile.o' failed make: * [qtemporaryfile.o] Error 1 make: * Waiting for unfinished jobs.... make: *** No targets specified and no makefile found. Stop. ./build.sh: line 90: src/qt/bin/qmake: No such file or directory


早些時候,我已經下載了用於Linux的可執行文件,所以它不能正常工作。這一次,我下載了windows的可執行文件並將其放在C:/ cygwin/bin中,並且它工作正常!

我不明白爲什麼我需要下載Windows可執行文件,當cygwin是一個Linux模擬器。這使我困惑,但至少現在它起作用了!

+0

假設您正確地擁有文件'C:\ cygwin \ bin \ phantomjs.exe',請嘗試使用該文件的完整路徑調用它。 –

+0

也忘記了安裝PhantomJS的'pip install'方法。這是完全錯誤的安裝方式。 –

+0

感謝您對pip安裝的建議。 當我嘗試使用完整路徑運行phantomjs時,仍然收到相同的錯誤:無法執行二進制文件 –

回答

3

從Cygwin的網站:

Cygwin is not: a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.

每一個應用程序需要爲了在Windows上使用,以進行重建(因爲它不會產生一個ELF文件,而是.exe文件,需要cygwin的DLL)。不過,cygwin中的shell可以執行任何windows的.exe文件(如ping,ipconfig,cmd等),這就是爲什麼你可以在cygwin下運行PhantomJS的windows版本。

0

恰好碰到了這個問題,將用C可執行phantomjs:/ Cygwin的/ bin中解決一切。之後,您只需運行命令C:/ cygwin/bin/phantomjs來初始化應用程序。

雖然Cygwin不會替換標準的cmd提示符,但它非常有用!