GithubHelp home page GithubHelp logo

phantomjs's Introduction

phantomjs-prebuilt

WARNING: This repository and NPM package are now deprecated since PhantomJS development had been suspended.

An NPM installer for PhantomJS, headless webkit with JS API.

Build Status

Building and Installing

npm install phantomjs-prebuilt

Or grab the source and

node ./install.js

What this installer is really doing is just grabbing a particular "blessed" (by this module) version of Phantom. As new versions of Phantom are released and vetted, this module will be updated accordingly.

Running

bin/phantomjs [phantom arguments]

And npm will install a link to the binary in node_modules/.bin as it is wont to do.

Running via node

The package exports a path string that contains the path to the phantomjs binary/executable.

Below is an example of using this package via node.

var path = require('path')
var childProcess = require('child_process')
var phantomjs = require('phantomjs-prebuilt')
var binPath = phantomjs.path

var childArgs = [
  path.join(__dirname, 'phantomjs-script.js'),
  'some other argument (passed to phantomjs script)'
]

childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
  // handle results
})

Or exec() method is also provided for convenience:

var phantomjs = require('phantomjs-prebuilt')
var program = phantomjs.exec('phantomjs-script.js', 'arg1', 'arg2')
program.stdout.pipe(process.stdout)
program.stderr.pipe(process.stderr)
program.on('exit', code => {
  // do something on end
})

Note: childProcess.spawn() is called inside exec().

Running with WebDriver

run() method detects when PhantomJS gets ready. It's handy to use with WebDriver (Selenium).

var phantomjs = require('phantomjs-prebuilt')
var webdriverio = require('webdriverio')
var wdOpts = { desiredCapabilities: { browserName: 'phantomjs' } }

phantomjs.run('--webdriver=4444').then(program => {
  webdriverio.remote(wdOpts).init()
    .url('https://developer.mozilla.org/en-US/')
    .getTitle().then(title => {
      console.log(title) // 'Mozilla Developer Network'
      program.kill() // quits PhantomJS
    })
})

Versioning

The major and minor number tracks the version of PhantomJS that will be installed. The patch number is incremented when there is either an installer update or a patch build of the phantom binary.

Pre-2.0, this package was published to NPM as phantomjs. We changed the name to phantomjs-prebuilt at the request of PhantomJS team.

Continuous Integration

Please do not download PhantomJS for every CI job because it can quickly overload our CDNs. Instead take advantage of CI caching.

In Travis-CI add the following to your .travis.yml to enable caching & avoid repeated downloads of PhantomJS.

.travis.yml

cache:
  directories:
    - travis_phantomjs

before_install:
  # Upgrade PhantomJS to v2.1.1.
  - "export PHANTOMJS_VERSION=2.1.1"
  - "export PATH=$PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin:$PATH"
  - "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi"
  - "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then wget https://github.com/Medium/phantomjs/releases/download/v$PHANTOMJS_VERSION/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2; fi"
  - "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi"
  - "phantomjs --version"

Deciding Where To Get PhantomJS

By default, this package will download phantomjs from our releases. This should work fine for most people.

Downloading from a custom URL

If github is down, or the Great Firewall is blocking github, you may need to use a different download mirror. To set a mirror, set npm config property phantomjs_cdnurl.

Alternatives include https://bitbucket.org/ariya/phantomjs/downloads (the official download site) and http://cnpmjs.org/downloads.

npm install phantomjs-prebuilt --phantomjs_cdnurl=https://bitbucket.org/ariya/phantomjs/downloads

Or add property into your .npmrc file (https://www.npmjs.org/doc/files/npmrc.html)

phantomjs_cdnurl=https://bitbucket.org/ariya/phantomjs/downloads

Another option is to use PATH variable PHANTOMJS_CDNURL.

PHANTOMJS_CDNURL=https://bitbucket.org/ariya/phantomjs/downloads npm install phantomjs
Using PhantomJS from disk

If you plan to install phantomjs many times on a single machine, you can install the phantomjs binary on PATH. The installer will automatically detect and use that for non-global installs.

Cross-Platform Repositories

PhantomJS needs to be compiled separately for each platform. This installer finds a prebuilt binary for your operating system, and downloads it.

If you check your dependencies into git, and work on a cross-platform team, then you need to tell NPM to rebuild any platform-specific dependencies. Run

npm rebuild

as part of your build process. This problem is not specific to PhantomJS, and this solution will work for any NodeJS package with native or platform-specific code.

If you know in advance that you want to install PhantomJS for a specific architecture, you can set the environment variables: PHANTOMJS_PLATFORM (to set target platform) and PHANTOMJS_ARCH (to set target arch), where platform and arch are valid values for process.platform and process.arch.

A Note on PhantomJS

PhantomJS is not a library for NodeJS. It's a separate environment and code written for node is unlikely to be compatible. In particular PhantomJS does not expose a Common JS package loader.

This is an NPM wrapper and can be used to conveniently make Phantom available. It is not a Node JS wrapper.

I have had reasonable experiences writing standalone Phantom scripts which I then drive from within a node program by spawning phantom in a child process.

Read the PhantomJS FAQ for more details: http://phantomjs.org/faq.html

Linux Note

An extra note on Linux usage, from the PhantomJS download page:

There is no requirement to install Qt, WebKit, or any other libraries. It however still relies on Fontconfig (the package fontconfig or libfontconfig, depending on the distribution).

Troubleshooting

Installation fails with spawn ENOENT

This is NPM's way of telling you that it was not able to start a process. It usually means:

  • node is not on your PATH, or otherwise not correctly installed.
  • tar is not on your PATH. This package expects tar on your PATH on Linux-based platforms.
  • bzip2 is not on your PATH.

Check your specific error message for more information.

Installation fails with Error: EPERM or operation not permitted or permission denied

This error means that NPM was not able to install phantomjs to the file system. There are three major reasons why this could happen:

  • You don't have write access to the installation directory.
  • The permissions in the NPM cache got messed up, and you need to run npm cache clean to fix them.
  • You have over-zealous anti-virus software installed, and it's blocking file system writes.
Installation fails with Error: read ECONNRESET or Error: connect ETIMEDOUT

This error means that something went wrong with your internet connection, and the installer was not able to download the PhantomJS binary for your platform. Please try again.

I tried again, but I get ECONNRESET or ETIMEDOUT consistently.

Do you live in China, or a country with an authoritarian government? We've seen problems where the GFW or local ISP blocks github, preventing the installer from downloading the binary.

Try visiting the download page manually. If that page is blocked, you can try using a different CDN with the PHANTOMJS_CDNURL env variable described above.

I am behind a corporate proxy that uses self-signed SSL certificates to intercept encrypted traffic.

You can tell NPM and the PhantomJS installer to skip validation of ssl keys with NPM's strict-ssl setting:

npm set strict-ssl false

WARNING: Turning off strict-ssl leaves you vulnerable to attackers reading your encrypted traffic, so run this at your own risk!

I tried everything, but my network is b0rked. What do I do?

If you install PhantomJS manually, and put it on PATH, the installer will try to use the manually-installed binaries.

I'm on Debian or Ubuntu, and the installer failed because it couldn't find node

Some Linux distros tried to rename node to nodejs due to a package conflict. This is a non-portable change, and we do not try to support this. The official documentation recommends that you run apt-get install nodejs-legacy to symlink node to nodejs on those platforms, or many NodeJS programs won't work properly.

I'm using an unsupported version of Linux or an ARM processor. I get errors about "Unexpected platform or architecture". What do I do?

We only have binaries available for common OS / processor configurations. Sorry.

You may be able to get a PhantomJS binary from your operating system's package manager. Or you can build your own from source. If you put that binary on PATH, this installer will use it (see "Deciding Where to Get PhantomJS" above).

Contributing

Questions, comments, bug reports, and pull requests are all welcome. Submit them at the project on GitHub. If you haven't contributed to an Medium project before please head over to the Open Source Project and fill out an OCLA (it should be pretty painless).

Bug reports that include steps-to-reproduce (including code) are the best. Even better, make them in the form of pull requests.

Author

Dan Pupius (personal website) and Nick Santos, supported by A Medium Corporation.

License

Copyright 2012 A Medium Corporation.

Licensed under the Apache License, Version 2.0. See the top-level file LICENSE.txt and (http://www.apache.org/licenses/LICENSE-2.0).

phantomjs's People

Contributors

asciidisco avatar atimb avatar avindra avatar bleggett avatar casear avatar cognitom avatar connesc avatar ctalkington avatar dentarg avatar domenic avatar existentialism avatar fmenezes avatar iammerrick avatar ilshidur avatar jfuchs avatar marcbachmann avatar masakura2 avatar mastercactapus avatar mikesherov avatar myme avatar nathanjsweet avatar nicks avatar ntwb avatar okize avatar pdehaan avatar sergeylukin avatar shama avatar sshen avatar theefer avatar thoop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phantomjs's Issues

npm install error, file missing

Requesting /usr/local/lib/node_modules/phantomjs/tmp/phantomjs-1.8.0-linux-i686.tar.bz2
Receiving...
Error with http request { 'content-type': 'text/html; charset=UTF-8',
....

reson is missing file on googlecode.com

Failed at the [email protected] install script.

[email protected] install C:\Programme\JetBrains\IntelliJ11.dat\nodejs\node_modules\phantomjs
node install.js

Requesting c:\Program Files\nodejs\node_modules\phantomjs\tmp\phantomjs-1.8.2-windows.zip

events.js:72
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at errnoException (net.js:878:11)
at TCP.onread (net.js:539:19)
npm ERR! [email protected] install: node install.js
npm ERR! cmd "/c" "node install.js" failed with 8
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Programme\JetBrains\IntelliJ11.dat\nodejs\node.exe" "C:\Programme\JetBrains\IntelliJ11.dat\nodejs\node_modules\npm\bin\npm-cli.js" "install" "phantomjs"
npm ERR! cwd C:\Programme\JetBrains\IntelliJ11.dat\nodejs
npm ERR! node -v v0.10.1
npm ERR! npm -v 1.2.15
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Programme\JetBrains\IntelliJ11.dat\nodejs\npm-debug.log
npm ERR! not ok code 0

C:\Programme\JetBrains\IntelliJ11.dat\nodejs>

npb-debug.log:

PhantomJS not executable on Mac OS X in v1.9.1-1

The "executable" flag is not set in PhantomJS 1.9.1-1 on Mac OS X. This bug causes PhantomJS to fail with an "EACCES" error when run. Node v0.10.6, npm version 1.2.18. Not tried on any other OS.

It does work properly in 1.9.1-0.

Steps to reproduce:

  1. Create empty directory and cd into it.
  2. npm install [email protected]
  3. ls -l node_modules/phantomjs/lib/phantom/bin/phantomjs

Expected behavior: Permissions field containing execute flag: -rwxr-xr-x

Actual behavior: Permissions field does not contain execute flag: -rw-r--r--

Output when running phantomjs:

$ node_modules/.bin/phantomjs

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

Use npm's configured options for proxy

install.js looks only for http_proxy environment variable and ignores any values set in the npm configuration.

It should follow the npm standard of using the configured values and then falling back to environment variables as a default.

For example, if I do this:

npm config set proxy "http://my-proxy.mycompany.com:80"

It should be able to do the install even if the http_proxy environment variable is not set.

"npm install phantomjs" fails on Joyent's SmartOS

I've created a $25 bounty on ariya/phantomjs#10521 via https://www.bountysource.com/#issues/302363-support-solaris-and-also-joyent-smartos

npm http GET https://registry.npmjs.org/wordwrap
Unexpected platform or architecture: sunos ia32
npm ERR! [email protected] install: node install.js
npm ERR! sh "-c" "node install.js" failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System SunOS 5.11
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /opt/jenkins/jobs/scope.js/workspace
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE

error in using yeoman 1.5beta

getting this strange error of building out generators on yeoman - using node 8.23

npm ERR! [email protected] install: node install.js
npm ERR! sh "-c" "node install.js" failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 11.4.0
npm ERR! command "/Users/ms/.nvm/v0.8.23/bin/node" "/Users/ms/.nvm/v0.8.23/bin/npm" "install"
npm ERR! cwd /Applications/XAMPP/xamppfiles/htdocs/tt33
npm ERR! node -v v0.8.23
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Applications/XAMPP/xamppfiles/htdocs/tt33/npm-debug.log
npm ERR! not ok code 0

any ideas
M

phantomjs binaries don't work on older linux distributions

On older Linux distributions (CentOS 5, for example), the binary downloaded installed by install.js can't be run due to glibc dependencies.

/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.9' not found
/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.10' not found
/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.11' not found
/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.7' not found
/node_modules/phantomjs/lib/phantom/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found
/node_modules/phantomjs/lib/phantom/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found

PhantomJS does work when compiled from source, but I'm unable to find a way to programmatically discern between CentOS 5 and other Linux distros in a node environment to build from source in the installation script.

My workaround for now is a fork that checks to see if which phantomjs returns anything, and, if it does, use that path for binPath in lib/phantomjs.js instead of the local binary.

Running phantomjs throws error

Hi,

If I try to run an npm installed phantomjs version through the shell an error is thrown:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

I've tried all combinations of phantomjs versions 1.8.2-2, 1.9.0-2, 1.9.1-0 with nodejs versions 0.10.12, 0.10.2, 0.10.5, 0.8.23 and it always throws the same error.

Any idea what could be going wrong?

Error when installing phantomjs

C:\Users\kreed\Documents\Dev\jqueryplugins\jquery.waitForElement>npm install phantomjs
npm http GET https://registry.npmjs.org/phantomjs
npm http 304 https://registry.npmjs.org/phantomjs
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/unzip
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/unzip
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/pullstream
npm http GET https://registry.npmjs.org/binary
npm http GET https://registry.npmjs.org/setimmediate
npm http GET https://registry.npmjs.org/buffers
npm http GET https://registry.npmjs.org/readable-stream
npm http GET https://registry.npmjs.org/over/0.0.5
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/fstream
npm http 304 https://registry.npmjs.org/buffers
npm http 304 https://registry.npmjs.org/setimmediate
npm http 304 https://registry.npmjs.org/pullstream
npm http 304 https://registry.npmjs.org/binary
npm http 304 https://registry.npmjs.org/readable-stream
npm http 304 https://registry.npmjs.org/over/0.0.5
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/chainsaw
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/chainsaw
npm http GET https://registry.npmjs.org/traverse
npm http 304 https://registry.npmjs.org/traverse

> [email protected] install C:\Users\kreed\Documents\Dev\jqueryplugins\jquery.waitForElement\node_modules\phantomjs
> node install.js

Requesting C:\Users\kreed\Documents\Dev\jqueryplugins\jquery.waitForElement\node_modules\phantomjs\tmp\phantomjs-1.8.2-windows.zip
Receiving...
Received 814K...
Received 1598K...
Received 2380K...
Received 3165K...
Received 3950K...
Received 4732K...
Received 5516K...
Received 6301K...
Received 6906K total.
Extracting zip contents
Read stream closed

TypeError: undefined is not a function
    at Until.PullStream._flush (C:\Users\kreed\Documents\Dev\jqueryplugins\jquery.waitForElement\node_modules\phantomjs\node_modules\unzip\node_modules\pullstream\pullstream.js:112:5)
    at Until.<anonymous> (_stream_transform.js:131:12)
    at Until.g (events.js:175:14)
    at Until.EventEmitter.emit (events.js:117:20)
    at finishMaybe (_stream_writable.js:332:12)
    at endWritable (_stream_writable.js:339:3)
    at Until.Writable.end (_stream_writable.js:326:5)
    at C:\Users\kreed\Documents\Dev\jqueryplugins\jquery.waitForElement\node_modules\phantomjs\node_modules\unzip\lib\parse.js:282:25
    at process._tickCallback (node.js:415:13)
npm ERR! [email protected] install: `node install.js`
npm ERR! `cmd "/c" "node install.js"` failed with 8
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "phantomjs"
npm ERR! cwd C:\Users\kreed\Documents\Dev\jqueryplugins\jquery.waitForElement
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\kreed\Documents\Dev\jqueryplugins\jquery.waitForElement\npm-debug.log
npm ERR! not ok code 0

OS level dependencies

As mentioned on the PhantomJS download page:

"...It is however expected that some base libraries necessary for rendering (FreeType, Fontconfig) and the basic font files are available in the system."

The issue I had was a missing libfontconfig1-dev package (tested on a base ubuntu 12.04.2 install)

Perhaps it's worth mentioning the dependencies in the README, as this caused me (and probably lots of others) a few issues, due to a fairly deep dependency chain:

(grunt-contrib-qunit >> grunt-lib-phantomjs >> phantomjs)

PhantomJS install failed in Windows 7 with node 0.10.0 and npm 1.2.14

[email protected] install C:\Users\parkjh\Dropbox\js-workspace\webapp1\node_modules\phantomjs
node install.js

Requesting C:\Users\parkjh\Dropbox\js-workspace\webapp1\node_modules\phantomjs\tmp\phantomjs-1.8.2-windows.zip
Receiving...
Received 783K...
Received 1592K...
Received 2373K...
Received 3154K...
Received 3936K...
Received 4717K...
Received 5498K...
Received 6291K...
Received 6906K total.
Extracting zip contents
Read stream closed

TypeError: undefined is not a function
at Until.PullStream._flush (C:\Users\parkjh\Dropbox\js-workspace\webapp1\node_modules\phantomjs\node_modules\unzip\node_modules\pullstream\pullstream.js:112:5)
at Until. (_stream_transform.js:131:12)
at Until.g (events.js:175:14)
at Until.EventEmitter.emit (events.js:117:20)
at finishMaybe (_stream_writable.js:332:12)
at endWritable (_stream_writable.js:339:3)
at Until.Writable.end (_stream_writable.js:326:5)
at C:\Users\parkjh\Dropbox\js-workspace\webapp1\node_modules\phantomjs\node_modules\unzip\lib\parse.js:282:25
at process._tickCallback (node.js:415:13)
npm ERR! error rolling back Error: EPERM, rmdir 'C:\Users\parkjh\Dropbox\js-workspace\webapp1\node_modules\phantomjs\tmp\phantomjs-1.8.2-windows\phantomjs.exe'
npm ERR! error rolling back [email protected] { [Error: EPERM, rmdir 'C:\Users\parkjh\Dropbox\js-workspace\webapp1\node_modules\phantomjs\tmp\phantomjs-1.8.2-windows\phantomjs.exe']
npm ERR! error rolling back errno: 50,
npm ERR! error rolling back code: 'EPERM',
npm ERR! error rolling back path: 'C:\Users\parkjh\Dropbox\js-workspace\webapp1\node_modules\phantomjs\tmp\phantomjs-1.8.2-windows\phantomjs.exe' }
npm ERR! [email protected] install: node install.js
npm ERR! cmd "/c" "node install.js" failed with 8
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "phantomjs"
npm ERR! cwd C:\Users\parkjh\Dropbox\js-workspace\webapp1
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\parkjh\Dropbox\js-workspace\webapp1\npm-debug.log
npm ERR! not ok code 0

Clean up tmp after install

tmp/phantomjs-1.8.2-macosx.zip should be cleaned up after install. People who commit their node_modules folder to git will get this huge unneeded zip file.

Rename from tmp does not occur (Mac)

I just installed grunt-contrib-qunit, which depends on grunt-lib-phantomjs, which depens on node-phantomjs (this library).

Output:

$ npm install
...
npm http GET https://registry.npmjs.org/phantomjs
...
npm http 200 https://registry.npmjs.org/phantomjs
npm http GET https://registry.npmjs.org/phantomjs/-/phantomjs-0.2.2.tgz
npm http 200 https://registry.npmjs.org/phantomjs/-/phantomjs-0.2.2.tgz
...

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

Requesting .../node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip
Receiving...
Recieved 783K...
Recieved 1565K...
Recieved 2361K...
Recieved 3145K...
Recieved 3927K...
Recieved 4709K...
Recieved 5491K...
Recieved 6274K...
Recieved 7055K...
Recieved 7837K...
Recieved 8619K...
Recieved 9401K...
Recieved 10182K...
Recieved 10182K total.
Extracting zip contents
[email protected] node_modules/grunt-contrib-qunit
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

$

It is supposed to move the files to the lib directory, right?

Screenshot of resulting tree

Purpose of the phantomjs wrapper script

First of all sorry if the question is stupid, but I don't have experience writing npm modules.

What is the purpose of the bin/phantomjs wrapper script? As I see it It doesn't do anything useful except for figuring out the path to the binary which could be done beforehand during the installation.

The issue that I'm having is that when starting phantomjs from terminal through this wrapper the REPL mode does not work, since node does not forward input to phantomjs. When executing the binary directly REPL mode works fine.

Wouldn't it be possible to just symlink the binary itself into the bin directory instead of symlinking the wrapper script?

Alternate name

Can another name be given to the package? Something like phantom-autoinstall, phantom-wrapper, or anything along that line. I start to notice that people are already "confused" because of the naming and think that it is PhantomJS module for Node.js. Yes, I know the README clarifies this but nobody seems to bother reading it.

Don't get me wrong, I think this project is great. For various Node.js packages which rely on PhantomJS executable, depending on this package provides an easy way for unattended install.

Plans for adapting/forking to run SlimerJS?

I recently found out about SlimerJS. It is a (near) headless browser similar to PhantomJS but based on the Mozilla platform, wrapping Firefox/XulRunner.

They aim to be fully API compatible with PhantomJS and install in a very similar way. So logically most of the wrappers and interfaces for PhantomJS can be easily ported.

I tried starting something for this myself but I realise it goes a bit beyond my skill level to support.

But it looks like you can have this up in no time. Maybe a nice opportunity? You could keep both API's compatible and let the current PhantomJS / Webkit dependants easily port to Mozilla platform if SlimerJS takes of.

phantomjs-0.2.0 not working on Mac

The binary simply doesn't work, on ubuntu works great.

It seems the unzip module is not preserving the exec permission on zip extraction. :(
On Ubuntu works because that work is given to the tar command.

execvp

I'm getting execvp errors with the latest version. I'm on 0.8.{latest}.

1.8.3-1 worked. Any ideas?

npm install fails on Windows with "EPERM, operation not permitted" error during rename

Doing a npm install phantomjs on a Win7 machine is giving me the error below. Looks like everything works up until the very end, when the install script breaks on renaming the phantomjs dir?

I'm running the command under an admin account and I've also tried the "windows key -> type cmd -> right click on cmd icon and Run as administrator" trick but get the same error. I also checked that I have the required privileges on the directories.

Never had problems with installing any npm package before on the same machine.

Any ideas? The ENOTEMPTY error code suggests that the underlying cause is renaming an non-empty dir? 😕

Thanks!

...
Recieved 6605K total.
Extracting zip contents
Read stream closed
Renaming extracted folder phantomjs-1.7.0-windows  -> phantom

fs.js:439
  return binding.rename(pathModule._makeLong(oldPath),
                 ^
Error: EPERM, operation not permitted 'C:\...\noam\node_modules\phantomjs\tmp\phantomjs-1.7.0-windows'
    at Object.fs.renameSync (fs.js:439:18)
    at Extract.finishIt (C:\...\noam\node_modules\phantomjs\install.js:73:12)
    at Extract.EventEmitter.emit (events.js:123:20)
    at ProxyWriter.<anonymous> (C:\...\noam\node_modules\phantomjs\node_modules\unzip\lib\extract.js:34:10)
    at ProxyWriter.EventEmitter.emit (events.js:90:17)
    at DirWriter.EventEmitter.emit (events.js:90:17)
    at end (C:\...\noam\node_modules\phantomjs\node_modules\unzip\node_modules\fstream\lib\writer.js:323:12)
    at Writer._finish (C:\...\noam\node_modules\phantomjs\node_modules\unzip\node_modules\fstream\lib\writer.js:313:32)
    at endChmod (C:\...\noam\node_modules\phantomjs\node_modules\unzip\node_modules\fstream\lib\writer.js:185:44)
    at setProps (C:\...\noam\node_modules\phantomjs\node_modules\unzip\node_modules\fstream\lib\writer.js:293:5)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\...\noam\node_modules\phantomjs\tmp\phantomjs-1.7.0-windows'
npm ERR! error rolling back  [email protected] { [Error: ENOTEMPTY, rmdir 'C:\...\noam\node_modules\phantomjs\tmp\phantomjs-1.7.0-windows']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: 'C:\\...\\noam\\node_modules\\phantomjs\\tmp\\phantomjs-1.7.0-windows' }
npm ERR! [email protected] install: `node install.js`
npm ERR! `cmd "/c" "node install.js"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "phantomjs"
npm ERR! cwd C:\...\noam
npm ERR! node -v v0.8.11
npm ERR! npm -v 1.1.62
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\...\noam\npm-debug.log
npm ERR! not ok code 0

Can't install on OS X

This could be related to https://github.com/isaacs/npm/issues/3259

Dans-iMac:~/Documents/dev/spock (master)$ npm cache clear
Dans-iMac:~/Documents/dev/spock (master)$ npm inst --save-dev phantomjs
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm http GET https://registry.npmjs.org/phantomjs
npm http 200 https://registry.npmjs.org/phantomjs
npm http GET https://registry.npmjs.org/phantomjs/-/phantomjs-1.9.1-0.tgz
npm http 200 https://registry.npmjs.org/phantomjs/-/phantomjs-1.9.1-0.tgz
npm http GET https://registry.npmjs.org/adm-zip/0.2.1
npm http GET https://registry.npmjs.org/kew
npm http GET https://registry.npmjs.org/npmconf/0.0.24
npm http GET https://registry.npmjs.org/ncp/0.4.2
npm http GET https://registry.npmjs.org/mkdirp/0.3.5
npm http GET https://registry.npmjs.org/rimraf
npm http 200 https://registry.npmjs.org/ncp/0.4.2
npm http GET https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz
npm http 200 https://registry.npmjs.org/mkdirp/0.3.5
npm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm http 200 https://registry.npmjs.org/adm-zip/0.2.1
npm http GET https://registry.npmjs.org/adm-zip/-/adm-zip-0.2.1.tgz
npm http 200 https://registry.npmjs.org/npmconf/0.0.24
npm http GET https://registry.npmjs.org/npmconf/-/npmconf-0.0.24.tgz
npm http 200 https://registry.npmjs.org/kew
npm http GET https://registry.npmjs.org/kew/-/kew-0.1.7.tgz
npm http 200 https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/rimraf/-/rimraf-2.0.3.tgz
npm http 200 https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz
npm http 200 https://registry.npmjs.org/adm-zip/-/adm-zip-0.2.1.tgz
npm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm http 200 https://registry.npmjs.org/npmconf/-/npmconf-0.0.24.tgz
npm http 200 https://registry.npmjs.org/kew/-/kew-0.1.7.tgz
npm http 200 https://registry.npmjs.org/rimraf/-/rimraf-2.0.3.tgz
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/config-chain
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/once
npm http GET https://registry.npmjs.org/osenv/0.0.3
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/ini
npm http 200 https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.14.tgz
npm http 200 https://registry.npmjs.org/inherits
npm http 200 https://registry.npmjs.org/once
npm http GET https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz
npm http GET https://registry.npmjs.org/once/-/once-1.1.1.tgz
npm http 200 https://registry.npmjs.org/osenv/0.0.3
npm http GET https://registry.npmjs.org/osenv/-/osenv-0.0.3.tgz
npm http 200 https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/nopt/-/nopt-2.1.1.tgz
npm http 200 https://registry.npmjs.org/config-chain
npm http GET https://registry.npmjs.org/config-chain/-/config-chain-1.1.7.tgz
npm http 200 https://registry.npmjs.org/ini
npm http GET https://registry.npmjs.org/ini/-/ini-1.1.0.tgz
npm http 200 https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/semver/-/semver-1.1.4.tgz
npm http 200 https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.14.tgz
npm http 200 https://registry.npmjs.org/once/-/once-1.1.1.tgz
npm http 200 https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz
npm http 200 https://registry.npmjs.org/osenv/-/osenv-0.0.3.tgz
npm http 200 https://registry.npmjs.org/config-chain/-/config-chain-1.1.7.tgz
npm http 200 https://registry.npmjs.org/nopt/-/nopt-2.1.1.tgz
npm http 200 https://registry.npmjs.org/ini/-/ini-1.1.0.tgz
npm http 200 https://registry.npmjs.org/semver/-/semver-1.1.4.tgz
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/proto-list
npm http 200 https://registry.npmjs.org/proto-list
npm http GET https://registry.npmjs.org/proto-list/-/proto-list-1.2.2.tgz
npm http 200 https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz
npm http 200 https://registry.npmjs.org/proto-list/-/proto-list-1.2.2.tgz
npm http 200 https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz

> [email protected] install /Users/dan/Dropbox/Documents/dev/spock/node_modules/phantomjs
> node install.js

Download already available at /var/folders/h_/0qg_s9tn51gc_9sjsl46gvs80000gn/T/phantomjs/phantomjs-1.9.1-macosx.zip
Extracting zip contents
Phantom installation failed undefined
npm ERR! weird error 1
npm ERR! not ok code 0
Dans-iMac:~/Documents/dev/spock (master)$ 

[email protected] spawns too many processes

Running MacOS 10.8.4, given

$ node -v
v0.10.12
$ npm -v
1.2.32
$ npm cache clear
$ npm uninstall -g phantomjs
$ npm install -g phantomjs
/Users/alex/.nvm/v0.10.12/bin/phantomjs -> /Users/alex/.nvm/v0.10.12/lib/node_modules/phantomjs/bin/phantomjs

> [email protected] install /Users/alex/.nvm/v0.10.12/lib/node_modules/phantomjs
> node install.js

PhantomJS is already installed at /Users/alex/.nvm/v0.10.12/bin/phantomjs.
[email protected] /Users/alex/.nvm/v0.10.12/lib/node_modules/phantomjs
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

when I run phantomjs from one terminal no output is produced

$ phantomjs
^C%

and when I run another terminal

$ ps aux | grep node
alex           79336  25.4  0.4  3020884  14872 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79335  17.2  0.4  3020884  14888 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79337  15.0  0.3  3019604  13276 s003  R+   12:19AM   0:00.09 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79334  11.2  0.4  3020884  14816 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79329   8.3  0.4  3020884  14868 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79328   6.0  0.4  3020884  14864 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79327   4.2  0.4  3020884  14732 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79326   2.7  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79325   1.8  0.4  3020884  14732 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79324   1.5  0.4  3020884  14848 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79323   1.0  0.4  3020884  14756 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79322   0.6  0.4  3020884  14816 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79321   0.4  0.4  3020884  14904 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79320   0.3  0.4  3020884  14856 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79319   0.2  0.4  3020884  14856 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79318   0.1  0.4  3020884  14808 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79288   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79287   0.0  0.4  3020884  14828 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79286   0.0  0.4  3020884  14808 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79285   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79284   0.0  0.4  3020884  14852 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79283   0.0  0.4  3020884  14844 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79282   0.0  0.3  3020884  14664 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79281   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79280   0.0  0.4  3020884  14688 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79279   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79278   0.0  0.4  3020884  14848 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79277   0.0  0.3  3012692  14660 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79276   0.0  0.4  3020884  14788 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79275   0.0  0.4  3020884  14868 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79274   0.0  0.3  3020884  14664 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79273   0.0  0.4  3020884  14876 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79272   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79271   0.0  0.3  3020884  14664 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79270   0.0  0.4  3020884  14780 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79269   0.0  0.4  3020884  14852 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79268   0.0  0.4  3020884  14864 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79267   0.0  0.4  3020884  14876 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79266   0.0  0.4  3020884  14840 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79265   0.0  0.4  3020884  14740 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79361   0.0  0.0  2432768    456 s004  R+   12:19AM   0:00.00 grep node
alex           79317   0.0  0.4  3020884  14756 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79316   0.0  0.4  3020884  14876 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79315   0.0  0.4  3020884  14812 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79314   0.0  0.4  3020884  14852 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79313   0.0  0.4  3020884  14708 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79312   0.0  0.4  3020884  14852 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79311   0.0  0.4  3020884  14888 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79310   0.0  0.4  3020884  14724 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79309   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79308   0.0  0.3  3020884  14664 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79307   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79306   0.0  0.4  3020884  14888 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79305   0.0  0.4  3020884  14708 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79304   0.0  0.4  3020884  14856 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79303   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79302   0.0  0.4  3020884  14692 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79301   0.0  0.3  3020884  14664 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79300   0.0  0.3  3020884  14676 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79299   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79298   0.0  0.4  3020884  14880 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79297   0.0  0.4  3020884  14724 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79296   0.0  0.3  3020884  14664 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79295   0.0  0.4  3020884  14884 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79294   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79293   0.0  0.3  3020884  14680 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79292   0.0  0.3  3012692  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79291   0.0  0.3  3020884  14676 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79290   0.0  0.3  3020884  14668 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs
alex           79289   0.0  0.4  3020884  14856 s003  S+   12:19AM   0:00.10 node /Users/alex/.nvm/v0.10.12/bin/phantomjs

ouch.

1.9.0-4 fails to build as root

I'm not sure what changed, but we were installing packages using sudo npm install (not for any particular reason), and now it hits a permission denied when attempting to copy the binary.

Phantom installation failed Error: EACCES, permission denied '/home/ubuntu/tmp/phantomjs'
    at Object.fs.mkdirSync (fs.js:483:18)
    at mkdir (/opt/run/ee7627cda855db2d14060e189bc7fa55ea8d8723/tenxer/node_modules/phantomjs/install.js:205:8)
    at Promise._successFn (/opt/run/ee7627cda855db2d14060e189bc7fa55ea8d8723/tenxer/node_modules/phantomjs/install.js:57:7)
    at Promise._withInput (/opt/run/ee7627cda855db2d14060e189bc7fa55ea8d8723/tenxer/node_modules/phantomjs/node_modules/kew/kew.js:204:25)
    at Promise._chainPromise (/opt/run/ee7627cda855db2d14060e189bc7fa55ea8d8723/tenxer/node_modules/phantomjs/node_modules/kew/kew.js:244:13)
    at Promise.then (/opt/run/ee7627cda855db2d14060e189bc7fa55ea8d8723/tenxer/node_modules/phantomjs/node_modules/kew/kew.js:144:13)
    at /opt/run/ee7627cda855db2d14060e189bc7fa55ea8d8723/tenxer/node_modules/phantomjs/install.js:55:23
    at loadCbs.length (/opt/run/ee7627cda855db2d14060e189bc7fa55ea8d8723/tenxer/node_modules/phantomjs/node_modules/npmconf/npmconf.js:76:7)
    at Array.forEach (native)
    at /opt/run/ee7627cda855db2d14060e189bc7fa55ea8d8723/tenxer/node_modules/phantomjs/node_modules/npmconf/npmconf.js:75:13

Downloaded bin not executable?

The bin is downloaded, but it's not executable.

$ npm install --save-dev phantomjs
npm WARN package.json [email protected] No README.md file found!
npm http GET https://registry.npmjs.org/phantomjs
npm http 304 https://registry.npmjs.org/phantomjs
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/unzip
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/unzip
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/pullstream/0.0.4
npm http GET https://registry.npmjs.org/binary
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/binary
npm http 304 https://registry.npmjs.org/fstream
npm http 304 https://registry.npmjs.org/pullstream/0.0.4
npm http GET https://registry.npmjs.org/over
npm http GET https://registry.npmjs.org/stream-buffers
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/chainsaw
npm http GET https://registry.npmjs.org/buffers
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/over
npm http 304 https://registry.npmjs.org/stream-buffers
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/chainsaw
npm http 304 https://registry.npmjs.org/buffers
npm http GET https://registry.npmjs.org/traverse
npm http 304 https://registry.npmjs.org/traverse

> [email protected] install /Users/cowboy/Dropbox/Projects/repos/gruntjs/tmp/node_modules/phantomjs
> node install.js

Requesting /Users/cowboy/Dropbox/Projects/repos/gruntjs/tmp/node_modules/phantomjs/tmp/phantomjs-1.7.0-macosx.zip
Receiving...
Recieved 782K...
Recieved 1564K...
Recieved 2346K...
Recieved 3129K...
Recieved 3911K...
Recieved 4694K...
Recieved 5476K...
Recieved 6258K...
Recieved 7041K...
Recieved 7823K...
Recieved 8606K...
Recieved 9388K...
Recieved 10170K...
Recieved 10182K total.
Extracting zip contents
Renaming extracted folder phantomjs-1.7.0-macosx  -> phantom
Done
[email protected] node_modules/phantomjs
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected])

$ node -pe 'require("phantomjs").path'
/Users/cowboy/Dropbox/Projects/repos/gruntjs/tmp/node_modules/phantomjs/lib/phantom/bin/phantomjs

$ /Users/cowboy/Dropbox/Projects/repos/gruntjs/tmp/node_modules/phantomjs/lib/phantom/bin/phantomjs
-bash: /Users/cowboy/Dropbox/Projects/repos/gruntjs/tmp/node_modules/phantomjs/lib/phantom/bin/phantomjs: Permission denied

$ chmod +x /Users/cowboy/Dropbox/Projects/repos/gruntjs/tmp/node_modules/phantomjs/lib/phantom/bin/phantomjs

$ /Users/cowboy/Dropbox/Projects/repos/gruntjs/tmp/node_modules/phantomjs/lib/phantom/bin/phantomjs
phantomjs> 

Install.js should be idempotent (`npm rebuild` fails)

The install script fails if you run it twice in a row. This causes npm rebuild to fail, which can affect automated deployments and integration. Reproduced on Mac OS 10.8.3 and Windows XP using Node.js 0.8.23 and npm 1.2.18.

Steps to reproduce (Mac OS X):

mkdir temp
cd temp
npm install phantomjs
npm rebuild

Expected results: PhantomJS is reinstalled.

Actual results: The following error:

$ npm rebuild

> [email protected] install /Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs
> node install.js

Download already available in tmpdir
/var/folders/wy/y28k61p12q53p56sbgcj56bm0000gp/T/phantomjs/phantomjs-1.9.0-macosx.zip
Extracting zip contents
Renaming extracted folder phantomjs-1.9.0-macosx  -> phantom
Temporary files not renamed, maybe zip extraction failed.
npm ERR! [email protected] install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "rebuild"
npm ERR! cwd /Users/jshore/Documents/Projects/spikes/phantomjs
npm ERR! node -v v0.8.23
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/jshore/Documents/Projects/spikes/phantomjs/npm-debug.log
npm ERR! not ok code 0

Contents of npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'rebuild' ]
2 info using [email protected]
3 info using [email protected]
4 verbose read json /Users/jshore/Documents/Projects/spikes/phantomjs/package.json
5 verbose read json /Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/package.json
6 verbose read json /Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/adm-zip/package.json
7 verbose read json /Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/rimraf/package.json
8 verbose read json /Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/rimraf/node_modules/graceful-fs/package.json
9 verbose readInstalled returning [email protected]
10 verbose readInstalled returning [email protected]
11 verbose readInstalled returning [email protected]
12 verbose readInstalled returning [email protected]
13 verbose readInstalled returning undefined
14 info readInstalled object
15 verbose rebuild path, id [ '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs',
15 verbose rebuild   '[email protected]' ]
16 verbose rebuild path, id [ '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/rimraf',
16 verbose rebuild   '[email protected]' ]
17 verbose rebuild path, id [ '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/rimraf/node_modules/graceful-fs',
17 verbose rebuild   '[email protected]' ]
18 verbose rebuild path, id [ '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/adm-zip',
18 verbose rebuild   '[email protected]' ]
19 silly rebuild set [ '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs',
19 silly rebuild set   '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/rimraf',
19 silly rebuild set   '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/rimraf/node_modules/graceful-fs',
19 silly rebuild set   '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/node_modules/adm-zip' ]
20 info build /Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs
21 verbose from cache /Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs/package.json
22 info preinstall [email protected]
23 verbose linkStuff [ false,
23 verbose linkStuff   false,
23 verbose linkStuff   false,
23 verbose linkStuff   '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules' ]
24 info linkStuff [email protected]
25 verbose linkBins [email protected]
26 verbose link bins [ { phantomjs: './bin/phantomjs' },
26 verbose link bins   '/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/.bin',
26 verbose link bins   false ]
27 verbose linkMans [email protected]
28 verbose rebuildBundles [email protected]
29 verbose rebuildBundles [ 'adm-zip', 'rimraf' ]
30 info install [email protected]
31 verbose unsafe-perm in lifecycle true
32 silly exec sh "-c" "node install.js"
33 silly sh,-c,node install.js,/Users/jshore/Documents/Projects/spikes/phantomjs/node_modules/phantomjs spawning
34 info [email protected] Failed to exec install script
35 error [email protected] install: `node install.js`
35 error `sh "-c" "node install.js"` failed with 1
36 error Failed at the [email protected] install script.
36 error This is most likely a problem with the phantomjs package,
36 error not with npm itself.
36 error Tell the author that this fails on your system:
36 error     node install.js
36 error You can get their info via:
36 error     npm owner ls phantomjs
36 error There is likely additional logging output above.
37 error System Darwin 12.3.0
38 error command "node" "/usr/local/bin/npm" "rebuild"
39 error cwd /Users/jshore/Documents/Projects/spikes/phantomjs
40 error node -v v0.8.23
41 error npm -v 1.2.18
42 error code ELIFECYCLE
43 verbose exit [ 1, true ]

Unable to retrieve output

node tests.js and node.main (below) both appear to run, but do not produce output to the console. Ubuntu and OS X, problem must be simple, but I just don't see what's wrong.

main.js

var childProcess = require('child_process')
var phantomjs = require('phantomjs')
var path = require('path');
var binPath = '/home/parallels/node_modules/phantomjs/bin/phantomjs';

var childArgs = [
  path.join(__dirname, 'script.js'),
  'some other argument (passed to phantomjs script)'
]

childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
  console.log(stdout);
})

script.js:

Console.log("Hello World\n");
phantom.exit();

Not following semver for your versioning

I see you now have the third version of your 1.8.1 module available as 1.8.1-3. However, as noted in semver, the "dash plus {other}" indicates pre-release versions.

I believe the correct version string for your module would be 1.8.1+3, where the + represents a "build version".

Different paths for OSX and Linux executables

Hello and thanks for this fantastic project!

We are using phantomjs for a large enterprise project with dozens of developers. Rather than have every developer maintain their own npm dependencies, we have our node_modules directory checked-in under source control. This way, developers can pull from the repo, run grunt and everything "just works".

The issue is that we support multiple development environments. We have developers using Windows, Mac OSX, and Linux. Most of our grunt dependencies are platform-agnostic. However, since phantom has different binary executables for these three platforms, we need to have the superset of all three binaries checked in.

So far we have:

For Windows, we checked in:
lib/phantom/phantomjs.exe

For Mac OSX, we checked in:
lib/phantom/bin/phantomjs

We tried to do the same for Linux, but found that the path & filename for the Linux binary are the same as for Mac OSX.

Sure enough, in lib/phantomjs.js there is only a differentiation made between windows and "everything else"

exports.path = process.platform === 'win32' ?
    path.join(__dirname, 'phantom', 'phantomjs.exe') :
    path.join(__dirname, 'phantom', 'bin' ,'phantomjs')

What if we added platform-specific subdirectories in lib/phantom, and then changed the above snippet to:

switch (process.platform) {
  case 'win32':
    exports.path = path.join(__dirname, 'phantom', 'win', 'phantomjs.exe');
    break;
  case 'darwin':
    exports.path = path.join(__dirname, 'phantom', 'mac', 'phantomjs');
    break;
  case 'linux':
  default:
    exports.path = path.join(__dirname, 'phantom', 'linux', 'phantomjs');
    break;
}

This would allow us to check-in platform-specific binaries like:

lib/phantom/win32/phantomjs.exe
lib/phantom/mac/phantomjs
lib/phantom/linux/phantomjs

Thanks!

1.9.0-2 install fails on linux, 1.9.0-1 still works

1.9.0-2 also broken on Heroku Cedar (Ubuntu 10.04 linux, Amazon EC2).
Install works if you specify 1.9.0-1 version in package.json file.

Error log from Heroku:

/tmp/build_3riv3nhcdhqa9/node_modules/phantomjs/tmp/phantomjs-1.9.0-linux-x86_64.tar.bz2
Extracting tar contents (via spawned process)
Renaming extracted folder phantomjs-1.9.0-linux-x86_64  -> phantom
Temporary files not renamed, maybe zip extraction failed.
npm ERR! [email protected] install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.32-350-ec2
npm ERR! command "/tmp/node-node-Unqw/bin/node" "/tmp/node-npm-mkwr/cli.js" "rebuild"
npm ERR! cwd /tmp/build_3riv3nhcdhqa9
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /tmp/build_3riv3nhcdhqa9/npm-debug.log
npm ERR! not ok code 0

PhantomJS install failed in MacOS 10.8.2 with node 0.10.0 and npm 1.2.14

use command:

> sudo npm install phantomjs

return:

...
npm http GET ...
...
> [email protected] install /Users/<user>/Dev/github/jquery-rpc/node_modules/phantomjs
> node install.js

Requesting /Users/<user>/Dev/github/jquery-rpc/node_modules/phantomjs/tmp/phantomjs-1.8.2-macosx.zip
Receiving...
Received 782K...
Received 1564K...
Received 2346K...
Received 3128K...
Received 3910K...
Received 4692K...
Received 5475K...
Received 6257K...
Received 7041K...
Received 7823K...
Received 8605K...
Received 8934K total.
Extracting zip contents
Read stream closed

TypeError: undefined is not a function
    at Until.PullStream._flush (/Users/<user>/Dev/github/jquery-rpc/node_modules/phantomjs/node_modules/unzip/node_modules/pullstream/pullstream.js:112:5)
    at Until.<anonymous> (_stream_transform.js:131:12)
    at Until.g (events.js:175:14)
    at Until.EventEmitter.emit (events.js:117:20)
    at finishMaybe (_stream_writable.js:332:12)
    at endWritable (_stream_writable.js:339:3)
    at Until.Writable.end (_stream_writable.js:326:5)
    at /Users/<user>/Dev/github/jquery-rpc/node_modules/phantomjs/node_modules/unzip/lib/parse.js:282:25
    at process._tickCallback (node.js:415:13)
npm ERR! [email protected] install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 8
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "phantomjs"
npm ERR! cwd /Users/<user>/Dev/github/jquery-rpc
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/<user>/Dev/github/jquery-rpc/npm-debug.log
npm ERR! not ok code 0

Installation fails on Windows

I can't install phantomjs on Windows. I'm using Node v0.10.4.

At some point of the installation, it shows this error:

[email protected] install C:\Users\Breno\projects\teste\node_modules\phantomjs
node install.js

CreateProcessW: O sistema nÒo pode encontrar o arquivo especificado.
npm ERR! [email protected] install: node install.js
npm ERR! cmd "/c" "node install.js" failed with 127
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js"
"i" "phantomjs"
npm ERR! cwd C:\Users\Breno\projects\teste
npm ERR! node -v v0.8.17
npm ERR! npm -v 1.2.0
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\Breno\projects\teste\npm-debug.log
npm ERR! not ok code 0

Do you have any idea of what am I doing wrong? Or what possibly could be wrong?

Thanks in advance!

Programmatically expose path to installed script

It would be awesome if there was a built-in lib that exported, somehow, the fully resolved (absolute) path to the installed executable. Like so:

var child_process = require('child_process');
var phantom = require('phantomjs').path;

child_process.spawn(phantom, ['file.js']);

// etc

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

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'
├── [email protected]
│ ├── [email protected]
└─┬ [email protected]

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.

What happened to version 1.8.0?

I am not seeing that in the registry anymore? Was it unpublished? If so why? This is breaking one of my modules as a result.

Install failed: Unexpected platform or architecture: freebsd x64

sudo npm install -g phantomjs

npm http GET https://registry.npmjs.org/phantomjs
npm http 304 https://registry.npmjs.org/phantomjs
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/unzip
npm http 304 https://registry.npmjs.org/unzip
npm http 304 https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/pullstream
npm http GET https://registry.npmjs.org/binary
npm http GET https://registry.npmjs.org/readable-stream
npm http GET https://registry.npmjs.org/setimmediate
npm http GET https://registry.npmjs.org/buffers
npm http GET https://registry.npmjs.org/over/0.0.5
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/binary
npm http 304 https://registry.npmjs.org/fstream
npm http 304 https://registry.npmjs.org/pullstream
npm http 304 https://registry.npmjs.org/readable-stream
npm http 304 https://registry.npmjs.org/setimmediate
npm http 304 https://registry.npmjs.org/buffers
npm http 304 https://registry.npmjs.org/over/0.0.5
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/chainsaw
npm http GET https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/chainsaw
npm http 304 https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/traverse
npm http 304 https://registry.npmjs.org/traverse
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs

> [email protected] install /usr/local/lib/node_modules/phantomjs
> node install.js

Unexpected platform or architecture: freebsd x64
npm ERR! [email protected] install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System FreeBSD 9.1-RELEASE
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "phantomjs"
npm ERR! cwd /usr/home/jeff/dev/bkbs
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.2.12
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /usr/home/jeff/dev/bkbs/npm-debug.log
npm ERR! not ok code 0

BUT I'm alredy have install phantomjs from source via freebsd port "lang/phantomjs"
So dont need install "phantomjs binary" via npm.
But i need only node wrapper for work with grunt-contrib-qunit

Any workaround or can i get any fastfix ?

0.2.3 tests fail on OS X

I'm trying out your package, but it's doing nothing when I run the bin/phantomjs binary. So I cloned your repo, and on your master branch, I see the following when I npm test:

tests.js: FF
AssertionError: should download and extract proper binary
    at Object.assertWrapper [as ok] (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/lib/types.js:83:39)
    at Object.module.exports.testDownload (/Users/dave/Sites/repos/phantomjs/test/tests.js:17:10)
    at Object.wrapTest (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/lib/core.js:235:16)
    at wrapTest (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/lib/core.js:235:16)
    at Object.exports.runTest (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/lib/core.js:69:9)
    at exports.runSuite (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/lib/core.js:117:25)
    at _concat (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/deps/async.js:508:13)
    at async.forEachSeries.iterate (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/deps/async.js:118:13)
    at async.forEachSeries (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/deps/async.js:134:9)
    at _concat (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/deps/async.js:507:9)

AssertionError: should execute and return time to load page
    at Object.assertWrapper [as ok] (/Users/dave/Sites/repos/phantomjs/node_modules/nodeunit/lib/types.js:83:39)
    at module.exports.testExecFile (/Users/dave/Sites/repos/phantomjs/test/tests.js:32:12)
    at ChildProcess.exithandler (child_process.js:544:7)
    at ChildProcess.EventEmitter.emit (events.js:99:17)
    at maybeClose (child_process.js:638:16)
    at Socket.ChildProcess.spawn.stdin (child_process.js:815:11)
    at Socket.EventEmitter.emit (events.js:96:17)
    at Socket._destroy.destroyed (net.js:357:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)


FAILURES: 2/2 assertions failed (11ms)
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

more helping messages

when google code is blocked, installation can't be done,
while from the former console message I can't be told what to do

here I see, I can config npm a proxy, maybe it's better to tell end user when the request fail :)

Installation fails on MacOS for version 1.9.0-3

Even-though I'm able to install version 1.9.0-1, it fails for version 1.9.0-3. I get the following error:

[email protected] install /Volumes/MacintoshHD2/MyDocuments/Temp/my-phantomjs-01/node_modules/phantomjs
node install.js

Download already available in tmpdir
/var/folders/g8/hw52yyb176v6g4k168pp66_40000gn/T/phantomjs/phantomjs-1.9.0-macosx.zip
Extracting zip contents
Renaming extracted folder phantomjs-1.9.0-macosx -> phantom
Temporary files not renamed, maybe zip extraction failed.
npm ERR! [email protected] install: node install.js
npm ERR! sh "-c" "node install.js" failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 11.4.2
npm ERR! command "/Volumes/MacintoshHD2/MyDocuments/.nvm/v0.11.1/bin/node" "/Volumes/MacintoshHD2/MyDocuments/.nvm/v0.11.1/bin/npm" "install" "phantomjs"
npm ERR! cwd /Volumes/MacintoshHD2/MyDocuments/Temp/my-phantomjs-01
npm ERR! node -v v0.11.1
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Volumes/MacintoshHD2/MyDocuments/Temp/my-phantomjs-01/npm-debug.log
npm ERR! not ok code 0

npm ERR! Failed at the [email protected] install script.

platform is Windows.The error info :
C:\Users\Leo\AppData\Roaming\npm\phantomjs -> C:\Users\Leo\AppData\Roaming\npm\n
ode_modules\phantomjs\bin\phantomjs

[email protected] install C:\Users\Leo\AppData\Roaming\npm\node_modules\phanto
mjs
node install.js

Download already available at C:\Users\Leo\AppData\Local\Temp\phantomjs\phantomj
s-1.9.0-windows.zip
Extracting zip contents
Phantom installation failed ReferenceError: err is not defined
at extractDownload (C:\Users\Leo\AppData\Roaming\npm\node_modules\phantomjs
install.js:155:53)
at Promise._successFn (C:\Users\Leo\AppData\Roaming\npm\node_modules\phantom
js\install.js:68:12)
at Promise._withInput (C:\Users\Leo\AppData\Roaming\npm\node_modules\phantom
js\node_modules\kew\kew.js:204:25)
at Promise._chainPromise (C:\Users\Leo\AppData\Roaming\npm\node_modules\phan
tomjs\node_modules\kew\kew.js:244:13)
at Promise.then (C:\Users\Leo\AppData\Roaming\npm\node_modules\phantomjs\nod
e_modules\kew\kew.js:144:13)
at C:\Users\Leo\AppData\Roaming\npm\node_modules\phantomjs\install.js:67:11
at C:\Users\Leo\AppData\Roaming\npm\node_modules\phantomjs\node_modules\npmc
onf\npmconf.js:76:7
at Array.forEach (native)
at C:\Users\Leo\AppData\Roaming\npm\node_modules\phantomjs\node_modules\npmc
onf\npmconf.js:75:13
at C:\Users\Leo\AppData\Roaming\npm\node_modules\phantomjs\node_modules\npmc
onf\node_modules\once\once.js:17:15
npm ERR! [email protected] install: node install.js
npm ERR! cmd "/c" "node install.js" failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "D:\Program Files\nodejs\node.exe" "D:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install" "phantomjs" "-g"
npm ERR! cwd C:\Windows\System32
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Windows\System32\npm-debug.log
npm ERR! not ok code 0

NPM Installation Fails

Not sure if this is a problem with the package or my environment.

$ sudo npm install -g phantomjs
npm http GET https://registry.npmjs.org/phantomjs
npm http 304 https://registry.npmjs.org/phantomjs
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/adm-zip/0.2.1
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/adm-zip/0.2.1
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/graceful-fs
/usr/bin/phantomjs -> /usr/lib/node_modules/phantomjs/bin/phantomjs

> [email protected] install /usr/lib/node_modules/phantomjs
> node install.js

Requesting /usr/lib/node_modules/phantomjs/tmp/phantomjs-1.9.0-linux-x86_64.tar.bz2

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: connect ETIMEDOUT
    at errnoException (net.js:883:11)
    at Object.afterConnect [as oncomplete] (net.js:874:19)
npm ERR! [email protected] install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 8
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! 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 their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.38-16-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "phantomjs"
npm ERR! cwd /home/mahlers/Private/Projects/angular-strap
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/mahlers/Private/Projects/angular-strap/npm-debug.log
npm ERR! not ok code 0

Oddly enough, the file is there.

$ ls /usr/lib/node_modules/phantomjs/tmp
phantomjs-1.9.0-linux-x86_64.tar.bz2

This is on Ubuntu, with modern Node.js and NPM installations.

$ node -v
v0.10.4
$ npm -v
1.2.18

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.