2016-02-05 260 views
1

下面FreeBSD的phantomJS安裝問題

[email protected]:/data/www/node # npm i phantomjs 

運行命令後,我得到

npm WARN deprecated [email protected]: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt' 

> [email protected] install /data/www/node/node_modules/phantomjs 
> node install.js 

Looks like an `npm install -g`; unable to check for already installed version. 
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip 
Saving to /data/www/node/node_modules/phantomjs/phantomjs/phantomjs-2.1.1-macosx.zip 
Receiving... 
    [=======================================-] 98% 
Received 16746K total. 
Extracting zip contents 
Removing /data/www/node/node_modules/phantomjs/lib/phantom 
Copying extracted folder /data/www/node/node_modules/phantomjs/phantomjs/phantomjs-2.1.1-macosx.zip-extract-1454690434788/phantomjs-2.1.1-macosx -> /data/www/node/node_modules/phantomjs/lib/phantom 
Writing location.js file 
Done. Phantomjs binary available at /data/www/node/node_modules/phantomjs/lib/phantom/bin/phantomjs 
npm ERR! FreeBSD 9.3-RELEASE 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "phantomjs" 
npm ERR! node v5.4.1 
npm ERR! npm v2.14.7 
npm ERR! code EPEERINVALID 

npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements! 

npm ERR! Please include the following file with any support request: 
npm ERR!  /data/www/node/npm-debug.log 

這似乎是安裝phantomjs,但是當我試圖讓phantomjs版本

[email protected]:/data/www/node # phantomjs --version 

我得到這個

/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: Syntax error: Unterminated quoted string 
/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: Syntax error: Error in command substitution 
[email protected]:/data/www/node # 

有誰知道如何解決這個問題?我需要運行應該使用Node.js的phantom.JS服務器,但磨它的預期是在使用我得到一個錯誤

[Error: PhantomJS exited with return value 2] 

回答

0

你已經運行到節點包管理器的一個衆所周知的缺陷/ phantomjs的NPM包 - 它的安裝,即使你正在運行FreeBSD phantomjs的Mac OS X版本:

> [email protected] install /data/www/node/node_modules/phantomjs 
> node install.js 
... 
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip 

看到這個phantomJS問題:

https://github.com/ariya/phantomjs/issues/12963

或者,您可以從源代碼安裝phantomjs; FreeBSD有一個端口來做到這一點:

masheen(~) # cd /usr/ports/lang/phantomjs 
masheen(~) # make install