Medium/phantomjs

v1.9.2: EACCESS error on first install

zkat opened this issue · 13 comments

zkat commented

I installed phantomjs@1.9.2-0 globally with npm and got an error when I tried to run it as a user.

Steps:

  • $ sudo npm install -g phantomjs@1.9.2-0
  • $ phantomjs

Results:

Error executing phantom at /opt/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs
Error: spawn EACCES
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)
execvp(): Permission denied

Notes

However, this works:

$ sudo phantomjs
2013-09-10 16:14:04.943 phantomjs[25505:707] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 
phantomjs> ^D
$ phantomjs
2013-09-10 16:15:05.790 phantomjs[25510:707] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 
phantomjs>

I can execute phantomjs normally from then on, without any problems.

I tested this phantomjs@1.9.1-0, and didn't get this error.

+1 for the problem and for the work-around
Thanks @sykopomp

+1, for me at least, this seems to be an OS X 10.8 -> 10.9 (Mavericks) upgrade issue.

dpup commented

Works fine for me on mavericks. What's the exact error you are seeing.

Running PhantomJS via Karma:

Running "karma:unit-continuous" (karma) task
INFO [karma]: Karma server started at http://localhost:11080/__testacular/
INFO [launcher]: Starting browser PhantomJS
ERROR [launcher]: Cannot start PhantomJS
    Error: spawn EACCES
INFO [launcher]: Trying to start PhantomJS again.
ERROR [launcher]: Cannot start PhantomJS
    Error: spawn EACCES
INFO [launcher]: Trying to start PhantomJS again.
ERROR [launcher]: Cannot start PhantomJS
    Error: spawn EACCES
Warning: Task "karma:unit-continuous" failed. Use --force to continue.

Then load the console:

greg$ sudo phantomjs 
phantomjs> ^D 

Then Karma is able to load PhantomJS:

Running "karma:unit-continuous" (karma) task
INFO [karma]: Karma server started at http://localhost:11080/__testacular/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9 (Mac)]: Connected on socket id fMYJPR3jnv3PoSNiFmUd
........................................
PhantomJS 1.9 (Mac): Executed 40 of 40 SUCCESS (0.497 secs / 0.252 secs)

Done, without errors.

Using karma@0.10.2, karma-phantomjs-launcher@0.1.0, phantomjs@1.9.2-2. Do you think this an npm and/or Mavericks issue and not phantomjs?

dpup commented

If you run phantomjs without sudo it also fails?

Yes, it gave me the same error as @sykopomp. Once I ran it once under sudo it runs fine as me. I confirmed I am the file's owner and it has permissions 755. This seems more like an OS X issue frankly.

dpup commented

yeah, very strange.

-- Dan

On Tue, Dec 3, 2013 at 7:54 AM, Greg McGuire notifications@github.comwrote:

Yes, it gave me the same error as @sykopomp https://github.com/sykopomp.
Once I ran it once under sudo it runs fine as me. I confirmed I am the
file's owner and it has permissions 755. This seems more like an OS X issue
frankly.


Reply to this email directly or view it on GitHubhttps://github.com//issues/102#issuecomment-29721448
.

Running OSX 10.9 and have the same issue, launch with sudo and all is fine, thats an hour I'll never get back ;)

Having this issue as well. Is there any workaround? I want to automate something and have it work OS-agnostic so we can't run sudo everytime :(

+1 only works with sudo.

ykt commented

The problem seems because it is installed in the not writable folder. Another workaround that works for me is having phantomjs installed in the writable folder, e.g.:

setenv PATH "`echo $PATH`:./node_modules/phantomjs/bin/"

If I just run it once with sudo it works after that. I'm just running this after I install it:
sudo phantomjs --version

dpup commented

I don't have enough information to fix this so am going to close. If any of you can isolate the issue and propose a patch I'd happily review.