Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Support architectures where binaries aren't published on phantomjs.org #47

Closed
drook opened this issue Apr 14, 2013 · 9 comments
Closed

Comments

@drook
Copy link

drook commented Apr 14, 2013

I have built a working phantomjs binary for Solaris, and I need to install phantomjs node.js module (as far as i understand it uses the external binary, right ?). The README.md states that this can be done by running the

node ./install.js

However I got:

node install.js

module.js:340
    throw err;
      ^
Error: Cannot find module 'rimraf'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/emz/src/phantomjs/install.js:14:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

I have both rimraf and amd-zip modules installed globally:

[root@hyperion phantomjs]# npm list -g | egrep 'adm-zip|rimraf'
├── adm-zip@0.4.3
│ ├── rimraf@2.1.4
└─┬ rimraf@2.1.4

If I disable the module checking, I get:

node install.js
Unexpected platform or architecture: sunos x64

I'm not that familiar with npm internals and install scenarios, but I understand that phantomjs node module is just a couple of scripts itself, so can you please help me with installing ?

Thanks.

@drook
Copy link
Author

drook commented Apr 14, 2013

I tested my phantomjs helper with a rendering code - http://tech.hq.norma.perm.ru/files/google.png - seems like it's working beyond "hello world" too.

@dpup
Copy link
Contributor

dpup commented Apr 14, 2013

Per your first question, if you are installing from source using node install.js you'll need to make sure the npm dependencies are loaded. It's easiest to use npm install even if you have the source locally.

The package simply grabs a version of phantomjs from http://phantomjs.org/download.html, if there isn't a pre-packaged binary it won't work -- that's the 2nd error message you get.

I have been wondering if the package should allow for a globally installed phantomjs binary that is available on the PATH.

@drook
Copy link
Author

drook commented Apr 14, 2013

Yeah, that's exactly my case - the binary for the Solaris isn't avalable yet on http://phantomjs.org , but I have a locally built binary which is working. It's available in the PATH.

Can the module be installed this way ?

@drook
Copy link
Author

drook commented Apr 14, 2013

And I guess sooner or later some FreeBSD guys will be asking same thing (they don't have the prebuilt binary too). So installing the module having already the binary available would be just awesome.

@dpup
Copy link
Contributor

dpup commented Apr 14, 2013

I looked into this today, its kind of tricky because of the way NPM works.
At the the time the install script runs there's a "phantomjs" already
added to the PATH by NPM for this library. I considered adding an
environment variable that can be used to tell the library to use another
binary, but that seems pretty ugly.

-- Dan

On Sun, Apr 14, 2013 at 9:59 AM, drook notifications@github.com wrote:

And I guess sooner or later some FreeBSD guys will be asking same thing
(they don't have the prebuilt binary too). So installing the module having
already the binary available would be just awesome.


Reply to this email directly or view it on GitHubhttps://github.com//issues/47#issuecomment-16354316
.

@drook
Copy link
Author

drook commented Apr 14, 2013

Ookay.

I managed to install this locally by hand, using the customized script.
After local install those who are unfamiliar with node modules (like me) can manually copy the locally installed package to the global node.js module directory, and link the $NODEROOT/bin/phantomjs script to the phantomjs script in the module directory. Seems like after that everything is normal.

Script needs to be customized like the following:

if (process.platform === 'linux' && process.arch === 'x64') {
  downloadUrl += 'linux-x86_64.tar.bz2'
} else if (process.platform === 'linux') {
  downloadUrl += 'linux-i686.tar.bz2'
} else if (process.platform === 'darwin') {
  downloadUrl += 'macosx.zip'
} else if (process.platform === 'win32') {
  downloadUrl += 'windows.zip'
} else if (process.platform === 'sunos') {
  console.log('Getting a package for:', process.platform, process.arch)
  downloadUrl = 'http://files2.enaza.ru/phantomjs-1.9.0-sunos-x64.tar.bz2'
  console.log('Getting a package from:', downloadUrl)
} else {
  console.log('Unexpected platform or architecture:', process.platform, process.arch)
  process.exit(1)
}

http://files2.enaza.ru/phantomjs-1.9.0-sunos-x64.tar.bz2 is by the way prebuilt upstream package for the Solaris 11.1 x86, anyone who's using it's custom binary can just make a local repo with a web-server and a properly packaged phantomjs upstream binary.

Hope this will help to somebody.

@dpup
Copy link
Contributor

dpup commented Jul 3, 2013

As of 1.9.1-1 you should be able to install phantomjs manually and as long as it is on your $PATH the installer will detect it.

@dpup dpup closed this as completed Jul 3, 2013
@rachamma
Copy link

drook,

Do you have instructions to build phantom-js on solaris.. I am looking for a binary for solaris on sparc.

Thx

@drook
Copy link
Author

drook commented Jul 20, 2013

Yup, but you need to start in the right place. This is a node.js module, you need a phantomjs binary first. Look at ariya/phantomjs#10521 - there's a patch, you can start by applying it to the sources and trying to build. If it won't work for you, you can contact me, though I'm not a developer, but I'll try to help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants