상세 컨텐츠

본문 제목

031. Raspberry Pi 라즈베리 파이 - PhantomJS, CasperJS 설치

raspberrypi/raspbian

by ZelKun 2017. 6. 26. 10:00

본문

반응형


Headless기술에 관심이 생겨 PhantomJS, CasperJS 설치했습니다

기본적으로 NPM 사용해서 설치가 가능하지만

 

  • NPM 으로 PhantomJS 설치 에러..

pi@rasp2-dev:~ $ npm install phantomjs -g

npm WARN deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'

npm WARN deprecated node-uuid@1.4.8: Use uuid module instead

npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130

/usr/local/node-v7.9.0/bin/phantomjs -> /usr/local/node-v7.9.0/lib/node_modules/phantomjs/bin/phantomjs

 

> phantomjs@2.1.7 install /usr/local/node-v7.9.0/lib/node_modules/phantomjs

> node install.js

 

Considering PhantomJS found at /usr/bin/phantomjs

Found PhantomJS at /usr/bin/phantomjs ...verifying

PhantomJS detected, but wrong version 1.9.8 @ /usr/bin/phantomjs.

Unexpected platform or architecture: linux/arm

It seems there is no binary available for your platform/architecture

Try to install PhantomJS globally

npm ERR! Linux 4.4.8-v7+

npm ERR! argv "/usr/local/node-v7.9.0/bin/node" "/usr/bin/npm" "install" "phantomjs" "-g"

npm ERR! node v7.9.0

npm ERR! npm  v4.2.0

npm ERR! code ELIFECYCLE

npm ERR! errno 1

 

npm ERR! phantomjs@2.1.7 install: `node install.js`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the phantomjs@2.1.7 install script 'node install.js'.

npm ERR! Make sure you have the latest version of node.js and npm installed.

npm ERR! If you do, this is most likely a problem with the phantomjs package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR!     node install.js

npm ERR! You can get information on how to open an issue for this project with:

npm ERR!     npm bugs phantomjs

npm ERR! Or if that isn't available, you can get their info via:

npm ERR!     npm owner ls phantomjs

npm ERR! There is likely additional logging output above.

 

npm ERR! Please include the following file with any support request:

npm ERR!     /home/pi/.npm/_logs/2017-06-11T12_13_22_089Z-debug.log

pi@rasp2-dev:~ $ 

근데 NodeJS (v7.9.0)를 언제 설치한거지..?

PhantomJS NPM설치시 에러가 발생하니 github 올라와있는걸 사용했습니다

 

NPM이나 NodeJS 모른다면 이야기가 달라지겠지만..

Raspbian Jessie에는 nodejs v0.10.29 이미 설치되있습니다

근데 NPM 설치가 안되있으니 설치해야...

 

NPM만 설치하려면(nodejs는 재 설치 해봐야 v0.10.29)

sudo apt-get update && sudo apt-get install npm -y

하시면 됩니다 v1.4.21 이 설치되구요

 

nodejs나 npm을 좀더 최신으로 설치하려면

 

친절하게도 PhantomJS PI build한걸 배포하는걸 이용했습니다

build 환경 맞추는것도 그렇고.. 번거로운걸 안해도 되니 편합니다

 

  • PhantomJS

pi@rasp2-dev:~/utils $ git clone https://github.com/piksel/phantomjs-raspberrypi.git

Cloning into 'phantomjs-raspberrypi'...

remote: Counting objects: 153, done.

remote: Total 153 (delta 0), reused 0 (delta 0), pack-reused 153

Receiving objects: 100% (153/153), 25.31 MiB | 561.00 KiB/s, done.

Resolving deltas: 100% (32/32), done.

Checking connectivity... done.

Checking out files: 100% (107/107), done.

pi@rasp2-dev:~/utils $ ls

phantomjs-raspberrypi            wordpress-4.7.3.tar.gz

 

  • 실행환경 구성

pi@rasp2-dev:~/utils $ sudo mv phantomjs-raspberrypi /usr/local/

pi@rasp2-dev:~/utils $ sudo ln -s /usr/local/phantomjs-raspberrypi/bin/phantomjs /usr/bin/

pi@rasp2-dev:~/utils $ ph

phantomjs   phar5       php5        php5enmod   

phar        php         php5dismod  php5query

pi@rasp2-dev:~/utils $ phantomjs -v

1.9.8

 

웬만한건 전부 /usr/local/ 옮겨놓고 쓰고있으니..

역시나 /usr/local/ 옮겨줍니다

 

path 변경하는건 귀찮으니 시스템 path에 링크를 걸어줍니다

/usr/bin/ 링크걸어주면 됩니다

ph만 쓰고 탭(Tab)키를 눌러주면 phantomjs 가 리스트로 보이네요

버전은 1.9.8로 최신(2.1.1)은 아닙니다

 

최신으로 설치하고 싶으시면 Phantomjs build 페이지(http://phantomjs.org/build.html)를

참고하시면 됩니다만.. 추천해 드리진 않습니다..  삽질만 할테니까요

하드웨어 요구사항만 봐도 RAM 4G, CPU 1.8GHz 등등

 

  • CasperJS

NPM으로 설치해도 됩니다

pi@rasp2-dev:~/utils $ npm install casperjs -g

/usr/local/node-v7.9.0/bin/casperjs -> /usr/local/node-v7.9.0/lib/node_modules/casperjs/bin/casperjs

/usr/local/node-v7.9.0/lib

└── casperjs@1.1.4 

CasperJS 는 깔끔하게 끝

 

참고


반응형

관련글 더보기

댓글 영역