Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run any browser on Windows 7 64bits and node 0.10.2 #445

Closed
pocesar opened this issue Mar 31, 2013 · 16 comments
Closed

Can't run any browser on Windows 7 64bits and node 0.10.2 #445

pocesar opened this issue Mar 31, 2013 · 16 comments

Comments

@pocesar
Copy link

pocesar commented Mar 31, 2013

Right now, Karma version: 0.9.0 can't run:

C:\project>grunt test
Running "karma:unit" (karma) task
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser Firefox
Fatal error: spawn ENOENT

I don't know how to make it more "verbosy" to actually try to pin down the problem

@pocesar
Copy link
Author

pocesar commented Mar 31, 2013

trying to start it using .\node_modules\.bin\karma start gives me:

INFO [karma]: Karma v0.9.0 server started at http://localhost:9876/
WARN [preprocess]: Pre-processor "coffee" is not registered!
WARN [preprocess]: Pre-processor "coffee" is not registered!
INFO [Firefox 19.0 (Windows)]: Connected on socket id n8K5o2F9fl0DzUdd2XuU
WARN [preprocess]: Pre-processor "coffee" is not registered!
WARN [preprocess]: Pre-processor "coffee" is not registered!
Firefox 19.0 (Windows) ERROR

my karma.conf.js looks like this:

files = ['test/*.coffee'];
framworks = ["mocha"];
reporters = ['progress','dots'];
preprocessors = {
    '**/*.coffee': 'coffee'
};

digging out the sources, the preprocessors is actually the same, but it's failing to preprocess my test/main.coffee

BTW the framworks typo is intended?

@pocesar
Copy link
Author

pocesar commented Apr 1, 2013

calling the node module manually, it gives:

C:\Users\Webdev\Inetpub\socketexpress>.\node_modules\.bin\karma start karma.conf.js --single-run --browsers Firefox
INFO [karma]: Karma v0.9.0 server started at http://localhost:9876/
INFO [launcher]: Starting browser Firefox
ERROR [karma]: { [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
Error: spawn ENOENT
    at errnoException (child_process.js:948:11)
    at Process.ChildProcess._handle.onexit (child_process.js:739:34)

C:\project\node_modules\karma\lib\launchers\Base.js:66
      self._process.kill();
                    ^
TypeError: Cannot call method 'kill' of undefined
    at Object.kill (C:\project\node_modules\karma\lib\launchers\Base.js:66:21)
    at C:\project\node_modules\karma\lib\launcher.js:58:15
    at Array.forEach (native)
    at kill (C:\project\node_modules\karma\lib\launcher.js:56:14)
    at EventEmitter.emit (events.js:95:17)
    at emitAsync (C:\project\node_modules\karma\lib\events.js:33:10)
    at disconnectBrowsers (C:\project\node_modules\karma\lib\server.js:200:19)
    at process.<anonymous> (C:\project\node_modules\karma\lib\server.js:225:5)
    at process.EventEmitter.emit (events.js:95:17)
    at process._fatalException (node.js:272:26)

@typeofweb
Copy link

I have exactly the same problem on Ubuntu, so it's not Windows-specific problem.

@vojtajina
Copy link
Contributor

Use stable karma, that's 0.8.2.

@typeofweb
Copy link

The issue stays for both karma 0.8.2 and 0.8.3:

INFO [karma]: Karma server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
ERROR [karma]: { [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
Error: spawn ENOENT
    at errnoException (child_process.js:948:11)
    at Process.ChildProcess._handle.onexit (child_process.js:739:34)

@vojtajina
Copy link
Contributor

I think it's just Karma can't find the firefox binary (plus the error msg is weird, because of #452), can you try to set the env variable FIREFOX_BIN to path of your firefox ?

@vict-shevchenko
Copy link

Hi, setting env varible (User variable) CHROME_BIN to equal C:\Program Files\Google\Chrome\Application\chrome.exe resolves the problem well.

OS - Win 7 x86.

@dignifiedquire
Copy link
Member

Great. Will close for now, please reopen if this error is persists with 0.8.3

@raphaelvalerio
Copy link

I just got this problem using 0.8.5 on Win 8 64-bit while running build on a yeoman angular app scaffolded project (grunt 0.4.1). By following the suggestion of @vict-shevchenko I was able to resolve the problem (except in my case, as I'm on 64-bit, replacing the "Program Files" folder with "Program Files (x86)"). So, unfortunately, as far as I can tell the problem still exists in >= 0.8.3.

It may be that this is a fringe case issue, in which case perhaps simply adding the User Variable instructions to a FAQ is sufficient?

@ElliotPsyIT
Copy link

Sorry, having this same problem as above on Windows Server 2008 R2. Having set CHROME_BIN (either user or system variable) did not resolve this. I am starting Karma in the context of an Angularjs project I set up through Yeoman. I use Grunt and the Gruntfile.js from the Yeoman/Angularjs setup to start karma - the karma.config.js sets a single run and sets Chrome as the browser. I believe I have updated versions of nodejs, grunt and karma, as below. I am running this from within Powershell.

So, first I'm confirming the CHROME_BIN points to Chrome exe. Then I run versions of node, grunt and karma to show updates. Then run karma using grunt. Then, try to start karma directly, which shows the error message and freezes powershell.

Excuse any naivete here. I'm a rank newbie. Any assistance would be greatly appreciated!

C:> $env:CHROME_BIN
C:\Program Files (x86)\Google\Chrome\Application

C:\Users\meUser> node --version
v0.10.1
C:\Users\meUser> grunt --version
grunt-cli v0.1.8
C:\Users\me> karma --version
Karma version: 0.8.5

C:\myapp> grunt karma:unit
Running "karma:unit" (karma) task
INFO [karma]: Karma server started at http://localhost:8080/
INFO [launcher]: Starting browser Chrome
Fatal error: spawn ENOENT

C:\Users\meUser\AppData\Roaming\npm> karma start C:\oef41_app\karma.conf.js
INFO [karma]: Karma server started at http://localhost:8080/
INFO [launcher]: Starting browser Chrome
ERROR [karma]: { [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
Error: spawn ENOENT
at errnoException (child_process.js:945:11)
at Process.ChildProcess._handle.onexit (child_process.js:736:34)

@raphaelvalerio
Copy link

@fielstem: Well, that's certainly the problem you'd receive if Karma can't find and spawn Chrome. I can only offer rather simplistic suggestions --

This is probably redundant, but are you pointing exactly to: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (the exe file specifically and not just the folder)?

Have you tried a different shell? This is a very remote contingency, but I do encounter situations on Windows in which certain shells can cause trouble. I just tried running "grunt test" in a yo-angular app on both msysgit (mingw32, git for windows) and the vanilla Command prompt, both successfully (note that if you run "grunt karma:unit" the process will hang after closing Chrome -- you'll have to kill it with CTL-C; "grunt test" will close the process automatically and drop you back to the prompt, however).

Also, just for the heck of it, did you try running the command from a shell opened with administrator rights? I sometimes have to do this with specific Node commands. For instance, I can't create NPM symlinks unless I fire Git bash with administrator privileges. Because chrome.exe is in the higher-security Program Files folders, there's a remote possibly that Win Server 2008 is denying access, I suppose.

Another remote one: Node is at 0.10.7 (and NPM 1.2.21). I'm running Karma successfully on Node 0.10.5 (NPM 1.2.18). It wouldn't hurt to update just in the outside chance.

I know these aren't particularly insightful, but I thought I'd throw them out there just in the off chance they help.

@ElliotPsyIT
Copy link

Thanks so much Raphael for taking the time and providing a detailed set of suggestions! They were very helpful and I've made some progress.

  • CHROME_BIN env variable was not pointing to chrome.exe directly, only to the directory. So I changed that, but no change resulted in running either 'grunt test' or 'grunt karma:unit' under powershell.
  • But changing shells did make a difference both under cmd and git bash. In both shells, the test did run, but in an inconsistent manner over multiple iterations. Under standard cmd shell and under git bash shell, I ran either 'grunt test' or 'grunt karma:unit', and found the test hiccups. It required either 1, 2 or 3 auto restarts after the capture time out until it finally ran and finished (example 3x output below). I then changed the capturetimeout setting in karma.conf.js and it ran first time every time without hiccup (not shown):
    Running "karma:unit" (karma) task
    INFO [karma]: Karma server started at http://localhost:8080/
    INFO [launcher]: Starting browser Chrome
    WARN [launcher]: Chrome have not captured in 5000 ms, killing.
    INFO [launcher]: Trying to start Chrome again.
    WARN [launcher]: Chrome have not captured in 5000 ms, killing.
    INFO [launcher]: Trying to start Chrome again.
    INFO [Chrome 27.0 (Windows)]: Connected on socket id l_i1s3g6usydc4qIAbfc
    Chrome 27.0 (Windows): Executed 1 of 1 SUCCESS (0.44 secs / 0.027 secs)

Done, without errors.

  • I have a couple of F/U questions on setting up karma testing, if you don't mind.

First, I notice that whether I set up karma.conf.js as single run true or as false, the tests run once and the command line session closes and the Chrome test session closes. That process isn't slow exactly, but the overhead of opening Chrome each run gets old and makes testing drag. I had hoped that the testing could be setup for nearly instantaneously quick testing each run, as I've seen on various screencasts and gotten spoiled :) Maybe I'm not setting this up correctly?

Second, I am curious about the yeoman angular app setup. In the Gruntfile.js, both the 'grunt server' and the 'grunt test' tasks start a server on port 9000. So, if I first do 'grunt server' which opens a server on 9000 and starts the app running, then the 'grunt test' task fails because it's trying to open another server listening on port 9000. I could go in and modify the 'test' task in Gruntfile.js (though as a newbie I'm a little hesitant), but i'm just wondering why the config comes this way out of the both from Yeoman. I figure there is a purpose for this and that I may not be understanding how to run the app and run the tests quickly and easily.

Apologies for the extra questions when you've been so generous with time already. But in case you can squeeze in a bit more time for help, I would certainly appreciate it. Or, if these questions should be taken elsewhere, please let me know. Thanks again!!

-- Elliot

@wenihal
Copy link

wenihal commented May 31, 2013

I had the same issue. I had 64bit version of node.js and firefox is 32bit app, so I've uninstalled 64bit and installed 32bit version of node.js and now this error is gone. Hope this helps someone.

@vendethiel
Copy link

Actually I can run tests even with the wrong path, it works okay, but no capturing

@wstidolph
Copy link

@wenihal, thanks for the tip - that was it for me! And I have gotten rid of the CHROME_BIN and FIREFOX_BIN env vars and the 'grunt test' still runs, now that I use node.js 32 bit on my Win 8 Pro 64bit with 32bit Firefox and 32bit Chrome.

@pocesar
Copy link
Author

pocesar commented Jun 14, 2013

setting the env vars fixed for me, but PhantomJS never ever works.

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

No branches or pull requests

10 participants