Ok I see this question has been asked before however when I looked at the answers I am still unable to correctly set the environment variable. I tried using the export command but export is not recognized as an internal or external command. Does anyone know how to correctly set the env variable for PHANTOMJS_BIN without using the export command? The errors I am getting are cannot start PhantomJS can not find the binary C:\users.. please set env variable PHANTOMJS_BIN error in plugin gulp-karma karma exited with code
My node version is 4.4.2
It seems that you're using Windows. You can set an environment variable as shown in this question. Don't forget to reopen terminal after that.
For
exportcommand to work you'd need to use some unix terminal emulator, for example Git bash which is included with Git for Windows (Git/bin/bash.exe).But the real reason why env var won't work, I suspect, is a misconfiguration of PhantomJS path in Karma's config file, as described in this issue. It seems that at the very beginning of
karma.conf.jsthere is an incorrect setting overriding PATH variable:process.env.PHANTOMJS_BIN = 'node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs';If you remove it then the settings from PATH will be used. Or you could hardcode the real location of PhantomJS binary in order not to pollute PATH.