Meteor: How do you exactly install phantomJS?

There is no clear Phantom installation guide for Meteor, so I decided to ask a question to clarify the situation.

  • Do you need to install Phantom binary in /usr/local/bin/

    ? I downloaded the compiled one phantomjs

    from the official site and placed inside the above path. I can run phantomjs

    from anywhere because it is added to the path.

  • In addition to 1, you also need to install it from meteor npm

    ? I followed this to install "phantomjs": "1.9.13"

    as an npm package inside my Meteor app. It gets confused here because the binary is from the official site v2.0.0

    and the npm package is 1.9.13

    . Do I need to install both?

  • Due to confusion in 2, I removed /usr/local/bin/phantomjs

    , but then I cannot run $phantomjs

    anywhere because I have nothing in PATH

    .

My ultimate goal is to get a spiderable

job. What should I do?

+3


source to share


5 answers


Ok, the problem was that the compiled binary phantomjs

from the official webpage cannot be used right away on the latest Mac OS, but you have to unpack it first. To run the package, spiderable

you don't need to do anything other than place the binary phantomjs

inside your local path /usr/bin/local/

. You can check this by running $phantomjs

in your terminal. If you see phantomjs not found

, then you haven't installed it. If you see an error killed 9

, you will have the same problem as mine, and you can solve it by doing this .



You don't need a package meteorhacks:npm

.

+2


source


You can do this in two ways:

Method 1:

If you want to use PhantomJS through Meteor app you will need to use Meteorhacks NPM package and use latest NPM 1.9.16 I believe .

After that you can edit the packages.json file to add "phantomjs": "1.9.16" and then link to it via var phantomjs = Meteor.npmRequire('phantomjs');



Method 2:

Alternatively you can use the smart package for Meteor PhantomJS and take this snapshot.

I personally feel that Method 1 is the best option since it worked for me. I needed a PhantomJS app for my application and this solution worked for me. I haven't tried Method 2, so I can't speak for it, but it looks promising.

Give them a shot and let me know how it goes. Hope it helps!

+1


source


Here is the phantomjs wrapper package from atmosphere: https://atmospherejs.com/gadicohen/phantomjs

More importantly, this is an extensive package: https://atmospherejs.com/meteor/spiderable

I couldn't answer the questions, but nevertheless I want to say that you will solve your problem :)

0


source


In terminal:

$ meteor npm install --save phantomjs

In your_meteor_app / server / main.js file (or elsewhere if provided on the server side)

import phantom from 'phantom'

0


source


Just use npm:

//Global effect on your machine

      

npm install -g phantomjs

//Test if installed

      

npm list -g

//Test spiderable working correctly

      

Spiderable test

-1


source







All Articles