3

In the project that I'm working on, we use the Karma test runner, and karma-phantomjs-launcher to help us run tests using PhantomJS. Recently, we have discovered that the PhantomJS version that gets pulled down as a dependency to karma-phantomjs-launcher 1.9.8 has some issues that were making our tests fail. Fortunately, karma-phantomjs-launcher allows us to set the PHANTOMJS_BIN environment variable to point to an alternative PhantomJS binary to use instead, which made upgrading to 2.0.0 rather simple.

This is all fine and dandy, but when our continuous integration environment attempts to build our project, it is still pulling down the PhantomJS 1.9.8 binary when doing an npm install, since it needs to install karma-phantomjs-launcher which depends on PhantomJS 1.9.8.

Since our build server has been configured to use the 2.0.0 binary that we've given it, there really is no need to download the 1.9.8 binary, and I would prefer that it did not do that if possible.

So is there any way that I could configure my package.json to tell karma-phantomjs-launcher that it does not need to pull down its PhantomJS 1.9.8 dependency?

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
Michael Parker
  • 12,724
  • 5
  • 37
  • 58
  • Are you by any chance using TravisCI or CircleCI? We've solved the above issue on Circle, utilising a solution originating from a Travis setup. If the answer is *no*, then I doubt said solution would do you much good. –  Jul 25 '15 at 09:23
  • Having this same issue with our builds (using mocha-phantomjs). @KasperLewau, I'd be interested to hear how you guys solved it on CI? It's definitely the bottleneck in our npm install. – Alan Christopher Thomas Oct 09 '15 at 20:42

1 Answers1

1

Use a module without the dependency:

phantomjs package downloads PhantomJS from the third-party website. While this download can be prevented by making sure that you have correct PhantomJS version in the PATH, this is not always practical.

This package removes phantomjs from dependencies and requires you to set the path to PhantomJS explicitly.

Or remove it from the default package.json. For example, on a Linux shell:

cd node_modules/karma-phantomjs-launcher
vi package.json

Remove the dependencies declaration:

  "dependencies": {
    "phantomjs": "~1.9"
    },

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265