node package manager

slimerjs

Headless Gecko with JS API

slimerjs

An NPM installer for SlimerJS, a scriptable browser for web development and testing.

SlimerJS runs on Gecko, the browser engine behind Mozilla Firefox, and aims to be a simple, drop-in replacement for phantomjs. Because SlimerJS uses the version of firefox passed in the SLIMERJSLAUNCHER environment variable, edge builds of firefox can be used. This can be useful for viewing and testing modern web functionality which is not yet available in phantomjs.

npm install slimerjs

Or grab the source and

node ./install.js

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

bin/slimerjs [slimer arguments]

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

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

Below is an example of using this package via node.

var path = require('path')
var childProcess = require('child_process')
var slimerjs = require('slimerjs')
var binPath = slimerjs.path
 
var childArgs = [
  path.join(__dirname, 'slimerjs-script.js'),
  'some other argument (passed to slimerjs script)'
]
 
childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
  // handle results 
})
 

The major and minor number tracks the version of SlimerJS that will be installed. The major number tracks the major version of SlimerJS and the minor number tracks the minor + pad(2, patch) versions of SlimerJS.

The patch number is incremented when there is an installer update.

By default, this package will download slimerjs from https://download.slimerjs.org/releases/. This should work fine for most people.

If this site is down, or the Great Firewall is blocking it, you may need to use a download mirror. To set a mirror, set npm config property slimerjs_cdnurl. Default is ``.

npm install slimerjs --slimerjs_cdnurl=https://download.slimerjs.org/releases

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

slimerjs_cdnurl=https://download.slimerjs.org/releases

Another option is to use PATH variable SLIMERJS_CDNURL.

SLIMERJS_CDNURL=https://download.slimerjs.org/releases npm install slimerjs

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

SlimerJS 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 SlimerJS, 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 SlimerJS for a specific architecture, you can set the environment variables: SLIMERJS_PLATFORM (to set target platform) and SLIMERJS_ARCH (to set target arch), where platform and arch are valid values for process.platform and process.arch.

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

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

Standalone SlimerJS scripts can be driven from within a node program by spawning SlimerJS in a child process.

Read the SlimerJS FAQ for more details: https://slimerjs.org/faq.html

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.

Check your specific error message for more information.

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.

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

Do you live in China, or a country with an authoritarian government? We've seen problems where the GFW or local ISP blocks https://slimerjs.org, 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 SLIMERJS_CDNURL env variable described above.

You can tell NPM and the SlimerJS 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!

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

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.

Questions, comments, bug reports, and pull requests are all welcome. Submit them at the project on GitHub.

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

phantomjs-prebuilt authored by:

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

npm slimerjs modified from phantomjs by:

Thomas Grainger

phantomjs-prebuilt license:

Copyright 2012 A Medium Corporation.

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

npm slimerjs license:

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