How to install PhantomJS v2 with npm

时间秒杀一切 提交于 2019-11-30 16:53:22
Artjom B.

phantomjs-prebuilt was renamed from phantomjs and now additionally contains binaries for version 2.1+.

npm -g install phantomjs-prebuilt

The fork phantomjs2 is still available which contains version 2.0.

npm -g install phantomjs2

Keep in mind that not all platforms might be supported.

jojo

Phantomjs may be installed as a brew package. Confirm this:

brew ls | grep phantomjs

If you do have phantomjs installed as a brew package, you can easily uninstall it:

brew uninstall phantomjs

Then try rerunning npm install after updating your package.json for "2.0.0".

FYI: Please read semantic versioning: https://stackoverflow.com/a/22345808/3412545

I had troubles to install it via npm.

I decided to build it. I'm running Ubuntu 15.10.

First, check you have all the development packages installed :

sudo apt-get install build-essential g++ flex bison gperf ruby perl libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev libpng-dev libjpeg-dev python libx11-dev libxext-dev

Then download the source code : https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-source.zip

And run :
cd phantomjs-2.0.0-source sudo ./build.sh

It's a very long process to build it ! Be sure you know what you're doing.

npm install phantomjs-prebuilt try this for node users

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!