- Automation Testing
- DevOps ToolChain (Performance & SRE)
- Automation Score Quiz
- Automation Guild
- Call for Speakers
How to Install PhantomJS on Windows
- Headless website testing – this allows you to run functional tests using frameworks like Jasmine and WebDriver
- Screen Capture – quickly grabs a web page and saves as a screenshot
- Page Automation – PhantomJS has the ability to load and manipulate web pages.
- Network Monitoring – This is really useful to analyze your network behavior and application performance (I'm just diving into what can be done, but it looks very promising and fun!)
The reason I listed some of the functionality you can perform with PhantomJS is to highlight the fact that PhantomJS is not just for testing . You can use it for all kinds of things, including screen-scraping.
Because it's headless it's typically much faster, since your tests aren't required to run and render in a browser.
So now that we have a basic understanding of PhantomJS, let's actually install it and try a quick test to get started using this automation awesomeness.
NOTE: This is an older post. PhantomJs has been discontinued. Final release: 2.1.1 / January 24, 2016; 6 years ago. I recommend checking out using Playwright in headless mode as a replacement.
Installing PhantomJS on Windows
- Navigate to http://phantomjs.org/download.html
- Under the Windows section, click on the download link zip file
- Right click on the downloaded phantomJs zip file to Extract All
- Copy all the contents located in phantomjs-X.X.X-windows
- On your drive, create a new directory structure C:\ \PhantomJs\bin\phantomjs
- Paste the contents on the extracted phantomjs-X.X.X-windows directory here:
- Copy the path of the phantomjs directory (C:\ \PhantomJs\bin\phantomjs)
- Right click on my computer and select Properties
- Select Advanced system settings
- Click on the Environment Variables.. button
- Under the System Variables section, find the Path variable
- Click on the Edit.. button
- At the end of the existing Path, add a semicolon ( ; ) and then the path to
Cool! Now, according to the PhantomJs documentation, we should have all we need to get started since the binary is self-contained and has no external dependencies.
Run a quick PhantomJs test
Now, let's confirm that PhantomJs is configured and working on our machines.
- Open up Notepad and type the following:
- Save as joePhantom.js to your local C drive
- Open a command line and type: phantomjs joePhantom.js
What just happened with our PhantomJs script?
PhantomJS has a bunch of built-in modules that allow you to perform different tasks. For our example, we used the web page module , which allowed us to create a webpage instance. Then we used the open method to open joecolantonio.com.
This method also returns the page status (success or fail) depending on whether the page is loaded with issues or not.
For a list of all the methods, available check out the phantomJS API documentation.
Top 12 Automation Testing Trends Shaping 2024
As we enter 2024, what automation testing trends will shape the future? Each ...
What Is an SDET Meaning, Role, and Pay (2024 Guide)
First of all, if you’re wondering what SDET stands for, it’s a software ...
From DevOps to BizOps to AI and Beyond
I recently had a cool discussion with Alex Chernyak, Founder of ZapTest, about ...
Create Less Flaky Automation Tests. Quality content right in your inbox
Automation Testing can be frustrating. Don’t do it alone. Register now to get automation, performance, and security testing tips from some of the top experts in the industry.
I appreciate the information you send over email. It has really helped me to enhance my testing skills! Alisha Sheikh (Test Engineering Senior Analyst at Accenture)
Thank you for all the information provided in your newsletter. I am new in automation testing; hence, it is very helpful. Audrey Pruvot (TagPlay)
- Advertise with us
- Explore by categories
- Free Online Developer Tools
- Comment Policy
How to use PhantomJS in windows with the command prompt
- July 27, 2016
- 22.1K views
Learn how to use PhantomJS from the command prompt of Windows.
PhantomJS by itself has many features as website testing, it allow you to run functional tests with frameworks such as Jasmine, QUnit, Mocha, Capybara, WebDriver, and many others. It allow you to create screen captures, website automatization, manipulation of the document and network monitoring etc.
In this article we'll learn how to manipulate PhantomJS from the command line in Windows and test basic features as screenshots, PDF generation etc.
- A PhantomJS distribution for Windows, you can get the latest version in the download area of the official website here .
Note: there's no installation process as you'll get .zip file with two folder, examples and bin (which contains phantomjs.exe).
How does PhantomJS works
Imagine a simple web browser like Google Chrome, ready? Now remove the Graphic User Interface (GUI) and you'll get a headless browser, that's basically PhantomJS. They're great for automating and testing web pages programmatically and PhantomJS is one of the best available headless browsers.
Start using PhantomJS from cmd.exe
After the extraction of the download .zip file you'll get 2 folders : examples and bin. In Bin is located the executable of PhantomJS.
First, open the windows terminal cmd.exe and navigate to the bin path of phantomJS executing the following command:
Note: you can simply create an environment variable pointing to the location of Phantomjs.exe and the execute it from wherever you are in the console.
Now that you're located in the path of PhantomJS you'll be able to execute commands easily with phantomjs.
For your first exercise, we'll take a screenshot of Our Code World website. Create a screenshot.js file in the same location of the phantomjs executable :
And include the following code in the screenshot.js file:
Finally execute the following command in the command prompt :
Wait till is executed see the success message, and open the bin folder again.
Our Screenshot of the website has been created, awesome and really easy isn't ?.
Known windows issues
If the data is not transferred correctly, check if the network works as expected.
Specifically on Windows, the default proxy setting may cause a massive network latency. The workaround is to disable proxy completely, e.g. by launching PhantomJS with --proxy-type=none command-line argument.
Now that you know how does PhantomJS basically works, you'll be able to understand the documentation and discover all the awesome features that PhantomJS has to offer.
As always, we encourage you to check out the documentation to learn how to generate even PDF's, remote debuggin etc. Have fun !
Senior Software Engineer at Software Medico . Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.
Become a more social person
How to execute symfony 3 commands in windows with the command prompt
- April 02, 2016
- 11.8K views
How to import a mysql database using cmd prompt in XAMPP for Windows
- January 29, 2017
- 102.2K views
How to solve cmd or node.js command prompt issue in windows : git is not installed or not in the PATH
- March 22, 2016
How to configure an Integrated Terminal (command prompt) in NetBeans for Windows
- February 07, 2018
- 56.7K views
How to convert a MIDI file to WAV using Headless VLC Player (with the CLI) in Windows 10
- December 03, 2020
How to convert a MIDI file to MP3 using Headless VLC Player (with the CLI) in Windows 10
- December 04, 2020
- 10.2K views
All Rights Reserved © 2015 - 2024
Download the zip package, unzip it, and copy the executable to a system directory in which webdriver can look for the PhantomJS executable.
NULL (the executable is written to a system directory).
This function was designed primarily to help Windows users since it is cumbersome to modify the PATH variable. Mac OS X users may install PhantomJS via Homebrew. If you download the package from the PhantomJS website instead, please make sure the executable can be found via the PATH variable.
On Windows, the directory specified by the environment variable APPDATA is used to store phantomjs.exe . On OS X, the directory ~/Library/Application Support is used. On other platforms (such as Linux), the directory ~/bin is used. If these directories are not writable, the directory PhantomJS under the installation directory of the webdriver package will be tried. If this directory still fails, you will have to install PhantomJS by yourself.
PhantomJS - Scriptable Headless Browser
Important : PhantomJS development is suspended until further notice ( more details ).
Using QtWebKit as the back-end, it offers fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
The following simple script for PhantomJS loads Google homepage, waits a bit, and then captures it to an image.
PhantomJS is an optimal solution for:
Ready to play with PhantomJS? Install and follow the Quick Start guide.
Want to learn more? Read the FAQ , explore more examples , and study the complete API documentation .
For the source code, issue tracker, and other development information, visit github.com/ariya/phantomjs .
Search code, repositories, users, issues, pull requests...
We read every piece of feedback, and take your input very seriously.
Use saved searches to filter your results more quickly.
To see all available qualifiers, see our documentation .
A Composer Package which installs the PhantomJS binary (Linux, Windows, Mac) into /bin of your project.
Name already in use.
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI .
- Open with GitHub Desktop
- Download ZIP
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
- 156 commits
A Composer package which installs the PhantomJS binary (Linux, Windows, Mac) into /bin of your project.
Table of Contents
- How to require a specific version of PhantomJS?
How does this work internally?
- How to access the binary easily by using PhantomInstaller\PhantomBinary?
- How to package for another platform by overriding platform requirements?
- How to use a Mirror or a custom CDN URL for downloading?
To install PhantomJS as a local, per-project dependency to your project, simply add a dependency on jakoch/phantomjs-installer to your project's composer.json file.
For a development dependency, change require to require-dev .
The default download source used is: https://bitbucket.org/ariya/phantomjs/downloads/ You might change it by setting a custom CDN URL, which is explained in the section " Downloading from a mirror ".
By setting the Composer configuration directive bin-dir , the vendor binaries will be installed into the defined folder. Important! Composer will install the binaries into vendor\bin by default.
The scripts section is necessary, because currently Composer does not pass events to the handler scripts of dependencies. If you leave it away, you might execute the installer manually.
Now, assuming that the scripts section is set up as required, the PhantomJS binary will be installed into the /bin folder and updated alongside the project's Composer dependencies.
How to require specific versions of PhantomJS?
The environment and server variable PHANTOMJS_VERSION enables you specify the version requirement at the time of packaging.
You can also set the phantomjs-version in the extra section of your composer.json :
The search order for the version is 1) $_ENV, 2) $_SERVER, 3) composer.json (extra section), 4) fallback to v2.1.1 (hardcoded latest version).
- Fetching the PhantomJS Installer
In your composer.json you require the package "phantomjs-installer". The package is fetched by composer and stored into ./vendor/jakoch/phantomjs-installer . It contains only one file the PhantomInstaller\\Installer .
- Platform-specific download of PhantomJS
The PhantomInstaller\\Installer is run as a "post-install-cmd". That's why you need the "scripts" section in your "composer.json". The installer creates a new composer in-memory package "phantomjs", detects your OS and downloads the correct Phantom version to the folder ./vendor/jakoch/phantomjs . All PhantomJS files reside there, especially the examples .
- Installation into /bin folder
The binary is then copied from ./vendor/jakoch/phantomjs to your composer configured bin-dir folder.
- Generation of PhantomBinary
The installer generates a PHP file PhantomInstaller\\PhantomBinary and inserts the path to the binary.
To access the binary and its folder easily, the class PhantomBinary is created automatically during installation.
The class defines the constants BIN and DIR :
- BIN is the full-path to the PhantomJS binary file, e.g. /your_project/bin/phantomjs
- DIR is the folder of the binary, e.g. /your_project/bin
Both constants are also accessible via their getter-methods getBin() and getDir() .
This feature is similar to location.js of the phantomjs module for Node.
Override platform requirements
The environment and server variables PHANTOMJS_PLATFORM and PHANTOMJS_BITSIZE enable you to override the platform requirements at the time of packaging. This decouples the packaging system from the target system. It allows to package on Linux for MacOSX or on Windows for Linux.
Possible values for
- PHANTOMJS_PLATFORM are: macosx , windows , linux .
- PHANTOMJS_BITSIZE are: 32 or 64 .
Downloading from a mirror
You can override the default download location of the PhantomJS binary file by setting it in one of these locations. Listed in order of precedence (highest first):
- The environment variable PHANTOMJS_CDNURL
- The server variable PHANTOMJS_CDNURL
- In your composer.json by using $['extra']['jakoch/phantomjs-installer']['cdnurl'] :
Default Download Location
The default download location is Bitbucket: https://api.bitbucket.org/2.0/repositories/ariya/phantomjs/downloads/ . You don't need to set it explicitly. It's used, when PHANTOMJS_CDNURL is not set.
You might use one of the following mirror URLs as a value for PHANTOMJS_CDNURL :
- https://cnpmjs.org/downloads/ - USA, San Mateo (22.214.171.124)
- https://npm.taobao.org/mirrors/phantomjs/ - China, Hangzhou (126.96.36.199)
- https://github.com/Medium/phantomjs/ - USA, San Francisco (188.8.131.52)
This list of mirrors is not complete. If you know another mirror, please don't hesitate to add it here.
The mirror URLs are also not hardcoded, except for the Github URL. This enables you to point to any PhantomJS mirror or download folder you like. For instance, you could point to the URL of the download folder of your company, where the binaries are stored: PHANTOMJS_CDNURL=https://cdn.company.com/downloads/phantomjs/ .
Automatic download retrying with version lowering on 404
In case downloading an archive fails with HttpStatusCode 404 (resource not found), the downloader will automatically lower the version to the next available version and retry. The number of retries is determined by the number of hardcoded PhantomJS versions in getPhantomJSVersions() . This feature was added, because of the problems with v2.0.0 not being available for all platforms (see issue #25).
- Dockerfile 6.2%
pip install phantomjs Copy PIP instructions
Released: Apr 10, 2021
Python wrapper for PhantomJS
- Open issues:
View statistics for this project via Libraries.io , or by using our public dataset on Google BigQuery
License: BSD License (BSD)
Author: Md. Jahidul Hamid
Tags markdown, include, local, remote, file
- 5 - Production/Stable
- Information Technology
- OSI Approved :: BSD License
- OS Independent
- Python :: 3
PhantomJS wrapper in Python
- phantomjs: phantomjs command line tool.
Using with a custom phantomjs script:
In your phantomjs script, you can take the url as:
Using the default phantomjs script provided with this package:
Project details, release history release notifications | rss feed.
Apr 10, 2021
May 15, 2020
Mar 31, 2020
Nov 30, 2019
Nov 29, 2019
Download the file for your platform. If you're not sure which to choose, learn more about installing packages .
Uploaded Apr 10, 2021 source
Uploaded Apr 10, 2021 py3
Hashes for phantomjs-1.4.1.tar.gz
Hashes for phantomjs-1.4.1-py3-none-any.whl.
- português (Brasil)
How to download and install JDK on Windows
Windows 11 is a great operating system for productivity, but if you're a programmer, there's a high chance you're going to need to install and use Java as part of your workflow. Oracle has the Java Development Kit (known as JDK for short) that you can use to help build your apps. It comes with all the tools you'll need, like a virtual machine, debugging tools, and more. Installing the JDK on Windows is actually quite easy, so here's how to get started with it.
How to install JDK on Windows
There are two ways to install JDK on Windows, and it's a two-part process. You can install using a traditional EXE installer, or an MSI file, and then edit the Windows variables for Java files. Regardless, to install the JDK on Windows, your PC has to meet the system requirements set by Oracle. There is more technical information available through Oracle , but the basics is that your CPU architecture needs to be 64-bit.
Once you pass that, you'll be good to go. Also, keep in mind that JDK installers only work with one Java release at a time. You can't use an older installer on top of a new one. You'll see an error prompting you to remove the newer version if you attempt to do this when a newer one is already installed. All that said, here's what you can do.
Using the EXE installer
- Visit the Java Downloads page .
- Click the Windows tab.
- Download and choose your Java version. There's currently JDK 21 and JDK 17 .
- Once the download is complete, double-click to launch the file.
- If prompted by the Windows UAC, click Yes.
- Click Next then Next and wait for the installation to be completed.
- If you prefer, you also can run this installer silently using the command prompt, without interacting with any dialogues. Just type jdk-21_windows-x64_bin.exe /s in the command prompt.
Using the MSI Enterprise Installer
If you're planning to run the JDK in an enterprise scenario, it's suggested using an MSI installer. This installer runs with minimal dialogue and also supports silent installations, where you have to click through fewer commands. It's even customizable.
- Choose and download your Java version. There's currently JDK 21 and JDK 17 .
- Once the download is complete, double-click the MSI file to launch it.
- Alternatively, you can use the Command Prompt to install silently, or with the basic UI.
- To install with the basic UI in Command Prompt, use the command: msiexec.exe /i jdk-20_windows-x64_bin.msi
- To install silently, use the command: msiexec.exe jdk-20_windows-x64_bin.msi /qn
Once the installation is complete, navigate to the following path in File Explorer. C> Program Files> Java>JDK21>bin. Copy the path in the navigation bar by tapping in the box and choosing Copy .
Configure JDK post-setup
Once the JDK setup is complete, you'll need to tweak a few settings in Windows to get started with coding and building apps. You'll need to edit system variables so you can edit JDK files.
- Open your Start Menu and search for: edit the system environment variables.
- Click Open.
- Choose the Advanced tab.
- Click Environment Variables.
- Under System Variables, double-click on Path.
- Paste the path you copied earlier and click OK.
- Close any other open windows.
Once installation is complete, launch Command Prompt and type the command java --version. If you see a readout, you've successfully installed Java on Windows! You're now ready for development! The Java SDK is also available on macOS and Linux as well. So, if you have a device running those operating systems, check out our guide on how to install Java on Ubuntu , and how to install Java on macOS .
Can your Windows 10 PC be saved in 2025? Yes - for free. Here's how
We all know that some perfectly good Windows 10 PCs can't be upgraded to Windows 11. But did you know that Canalys Insights estimated there are 240 million Windows 10 PCs doomed to the trash heap because they can't be upgraded to Windows 11 after Microsoft dumps Windows 10 support on October 14, 2025 ? Wow. That's a lot.
And, it may be worse than that. According to IT asset management firm Lansweeper 's count, 40% of all enterprise workstations can't make the upgrade, which would put the number of Windows 10 PCs counting the day to their death to about 400 million.
Also: When Windows 10 support runs out, you have 5 options but only 2 are worth considering
Why? Well, it's because many older Windows 10 machines don't have the CPU or the Trusted Platform Module (TPM) needed for Windows 11. The TPM isn't usually a problem, but if you have a PC from 2019 or earlier, the CPU is likely to be unsupported.
So, what's a user to do when his or her Windows machine can't make the grade? Well, here's one choice you shouldn't make: Do not just keep running Windows 10 come the fall of 2025. Your machine will be hacked. There's no ifs, ands, or buts about it.
What Microsoft and its hardware friends want you to do is just buy a new PC. They hope you'll buy, say, a thousand or two, but they'll sell you one or two as well. They're not proud.
Or, you could gird your loins and hack your way to installing Windows 11 on your PC even though, officially, Microsoft won't support you if you try this trick. It's a bit complicated upgrading an unsupported Windows 10 PC to Windows 11 , as ZDNET's resident Windows expert Ed Bott explains, but it's not that hard either.
There's also an open-source program, Rufus , that makes it easy to bypass the Windows 11 system check. This bootable USB drive creation program gives you the option of skipping Windows 11 system requirements when you try to do an in-place upgrade.
Then, of course, there's my suggestion: Move from your soon-to-be-outdated Windows 10 to Linux . Yes, I know you've been told that Linux is hard to use and hard to install. It's not.
Also: Thinking about switching to Linux? 9 things you need to know
Sure, back in the '00s, you needed to be a Linux shell command wizard to install it and run its software. That was a long time ago. Today, anyone can run Linux. Heck, more than a decade ago, I taught a 79-year-old how to run Ubuntu Linux, and we didn't even share a common language!
Another advantage of running Linux is that your PC will never be left behind. I have computers in my office that are more than a decade old that came with Windows XP on them, and they're still running up-to-date Linux to this day.
If you really can't see yourself learning Linux, how about ChromeOS? You can use a web browser, right? Of course you can.
Thanks to ChromeOS Flex , you can take pretty much any PC from the last decade or so and get it running ChromeOS. I upgraded a Dell Inspiron One 2320 with Windows 7 to ChromeOS Flex . This all-in-one (AIO) 2012 computer has a 2.4Ghz Intel Pentium Dual Core i5 processor, 6GBs of RAM, NVIDIA GeForce GT525M, and a 320GB hard drive, and it's a great ChromeOS machine, which I use as my Zoom workstation every day.
Also: Linux might be your best bet for heightening your desktop computer security
You can install and run ChromeOS Flex on any PC with a 64-bit processor, 4GBs of RAM, 16GBs of storage, and can be booted from a USB drive. It's easy-peasy to move any Windows machine to ChromeOS Flex .
Oh, there's some Windows application you just can't live without? Leaving aside that all the software companies are dumping standalone applications in favor of Software-as-a-service (SaaS) applications such as Microsoft 365, you can now run essentially any Windows app on Chromebooks . Cameyo and Google's new Virtual App Delivery (VAD service) enables you to run "legacy apps" on any Chromebook. There, they will appear as Progressive Web Apps (PWA). Microsoft uses this cloud-based approach itself to deliver applications.
For that matter, if you still have an Intel-powered Apple Mac and you're beginning to get nervous about when Apple will cut its support lifeline -- unlike Microsoft, Apple doesn't tell you when it will end hardware support -- you can also move your Mac to ChromeOS Flex. There's nothing remotely complicated about it.
Also: These two Linux desktops are the simplest picks for new users
By the way, neither Linux nor ChromeOS Flex will cost you a single dime. They're free now and forever.
You could, of course, just buy support for your Windows 10 machine. Microsoft has promised to offer Extended Security Updates (ESUs) for Windows 10 . How much will that run you? We don't know. Microsoft isn't saying.
In the past, Microsoft didn't offer any ESU for Windows 8.x. For Windows 7, ESU's price tag started at $25 per machine per year and then ramped up to $200 per device in year three. Those plans were messy. You couldn't get them straight from Microsoft. You had to find a Microsoft partner willing to work with you. For small businesses and individuals, that proved to be a major pain.
Finally, a company called OPatch offers customized patches for out-of-service operating systems. For example, 0Patch offers Windows Server 2012 support until 2026 , while Microsoft dropped support for it in October 2023. It's expected the company will offer Windows 10 support as well for about $25 a year.
So, don't trash your old Windows 10 PC! There are many ways to give them a long, useful life after Microsoft has left them behind.
Get a Windows 11 Pro license for $40 right now
Buy Microsoft Office and Windows 11 Pro for just $50
The best Windows laptop you can buy: Dell, Samsung, Lenovo, and more
- 8 Dependencies
- 517 Dependents
- 81 Versions
An NPM installer for PhantomJS , headless webkit with JS API.
Building and Installing
Or grab the source and
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.
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.
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 at the request of PhantomJS team.
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 .
Or add property into your .npmrc file (https://www.npmjs.org/doc/files/npmrc.html)
Another option is to use PATH variable PHANTOMJS_CDNURL .
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.
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
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
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).
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.
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:
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.
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.
Dan Pupius ( personal website ) and Nick Santos , supported by A Medium Corporation .
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).
npm i [email protected]
8 years ago