Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Error during loading "angular-webpack/node_modules/karma-phantomjs-launcher" plugin: Path must be a string. Received null #141

Open
line-p opened this issue Nov 1, 2016 · 12 comments

Comments

@line-p
Copy link

line-p commented Nov 1, 2016

After I run ./node_modules/karma/bin/karma --log-level debug start
I get the error message:

Error during loading "/Users/line/Documents/myfile/angular2.0/angular-webpack/node_modules/karma-phantomjs-launcher" plugin:
Path must be a string. Received null

Here is my karma.config.js:
var webpackConfig = require('./webpack.test');

module.exports = function (config) {
var _config = {
basePath: '',

frameworks: ['jasmine'],

files: [
  {pattern: './config/karma-test-shim.js', watched: false}
],

preprocessors: {
  './config/karma-test-shim.js': ['webpack', 'sourcemap']
},

webpack: webpackConfig,

webpackMiddleware: {
  stats: 'errors-only'
},

webpackServer: {
  noInfo: true
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['PhantomJS'],
singleRun: true

};

config.set(_config);
};

@sharedprophet
Copy link

Looks like #131 will help?

@nhhockeyplayer
Copy link

nhhockeyplayer commented Dec 10, 2016

i went to

node_modules\karma_phantomjs_launcher

change index.js to as follows

return path.join(path.dirname(phantomSource), '//node_modules/' + phantomPackage._location + '//lib//phantom//', phantomPackage.bin.phantomjs)
//return path.join(path.dirname(phantomSource), '//node_modules//phantomjs//lib//phantom//', phantomPackage.bin.phantomjs)

then run

npm i

went to ../phantomjs

npm i

reinstalled my project from its root dir

then karma start

this is not fixed and a show stopper. i am at a client site that needs this now and we cannot do anything

C:\apache-tomcat-8.0.23\webapps\ROOT\a2\widget.qualify\dropdown>karma start
10 12 2016 18:50:12.697:ERROR [plugin]: Error during loading "C:\Users\owner\AppData\Roaming\npm\node_modules/karma-phantomjs-launcher" plugin:
Path must be a string. Received null
10 12 2016 18:50:12.791:WARN [watcher]: Pattern "C:/apache-tomcat-8.0.23/webapps/ROOT/a2/widget.qualify/dropdown/test/**/*.js" does not match any file.
10 12 2016 18:50:12.810:WARN [karma]: No captured browser, open http://localhost:9876/
10 12 2016 18:50:12.829:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/
10 12 2016 18:50:12.830:INFO [launcher]: Launching browsers Chrome, PhantomJS with unlimited concurrency
10 12 2016 18:50:12.833:ERROR [karma]: Found 1 load error

@colinyoung
Copy link

@nhhockeyplayer lock it to github:karma-runner/karma-phantomjs-launcher in your package.json

@lloydwatkin
Copy link

lloydwatkin commented Jan 13, 2017

Have locked to master on github and still seeing the issue:

13 01 2017 22:02:59.759:ERROR [plugin]: Error during loading "$project/node_modules/karma-phantomjs-launcher" plugin:
  Path must be a string. Received null

This is running on travis CI.

Edit: Setting an env variable PHANTOMJS_BIN=./node_modules/.bin/phantomjs fixed things on travis

@andreasonny83
Copy link

I noticed this problem when enabling the Travis cache on node_packages.

cache:
  directories:
    - node_modules

After removing that cache, TravisCI succeed to run all the Karma tests

@lloydwatkin
Copy link

@andreasonny83 that's going to slow down your test runs though? So maybe not ideal :)

@ParAnton
Copy link

I just wanna inform that you can run into the same problem if you for some reason hasn't installed
phantomjs-prebuilt the right way. to fix this run
node web/node_modules/phantomjs-prebuilt/install.js
and look in the installed phantomjs-prebuilt/lib and see that the location.js file is present an look okay

@StefH
Copy link

StefH commented Mar 30, 2017

@lloydwatkin This solved my problem. Thanks.

See : https://travis-ci.org/StefH/PrimeNG-DataTable-Extensions

@ParAnton
Copy link

#120 seems to me to be the same issue

@SimenB
Copy link

SimenB commented Apr 21, 2017

#191 trying to fix this, or at least provide a better error message

@HuChaoyong
Copy link

I get same issue, solved it by install phantomjs. download http://phantomjs.org/download.html
then cut phantomjs.exe to my nodejs folder ,set environment path for phantomjs.exe
last . run this command node node_modules/phantomjs-prebuilt/install.js

@andreasonny83
Copy link

@StefH , you're caching the node_modules directory but you're also removing that during your script task. You can just adopt my solution and remove the node_modules from the cache directories instead.

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

No branches or pull requests

10 participants