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

node-notifier within node-webkit #33

Closed
JacopoDaeli opened this issue Oct 29, 2014 · 16 comments
Closed

node-notifier within node-webkit #33

JacopoDaeli opened this issue Oct 29, 2014 · 16 comments

Comments

@JacopoDaeli
Copy link

Hi I am trying to use node-notifier within node-webkit and it doesn't work.
When I test the app with nodewebkit module it works perfecty, therefore when I pack my app it doesn't work anymore and I get this from my WebKit Console:
Command failed: /bin/sh: /Users/jacopodaeli/Desktop/PublipingTrainer.app/Contents/Resources/app.nw/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier: Permission denied

My App is based on Node-WebKit 0.8.6 and it runs over Mac OS X 10.9.

Anyone can help me with this problem?

@mikaelbr
Copy link
Owner

This seem to be a similar issue as #17 ?
I haven't tried node-webkit myself, but it seems as there might be an issue with the absolute pathing and the node-webkit application trying to access something outside its container?

Could you try to set customPath to a relative path and possibly experiment some with the path?

@JacopoDaeli
Copy link
Author

Hey thank you. I will try tonight and I will let you know.

@majodev
Copy link

majodev commented Nov 7, 2014

Just encountered the problem and you might be able to solve it in a similar the fashion.

My solution: Check the file permission flags of the terminal-notifier.app/Contents/MacOS/terminal-notifier file, within your packaged application. Also, if you are using grunt tasks, e.g. grunt-contrib-copy, be sure to set the mode flag to true to keep all file permissions the same when you copy files over.

Your file permissions must look like this:

$ cd /Users/jacopodaeli/Desktop/PublipingTrainer.app/Contents/Resources/app.nw/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/
$ ls -l
-rwxr-x--x  1 user  staff  46324  7 Nov 14:31 terminal-notifier

My file was missing the executable flag, therefore Permission denied...

@mikaelbr
Copy link
Owner

How did this go @JacopoDaeli ? Is this issue resolved?

@JacopoDaeli
Copy link
Author

Nope! :)

@mikaelbr
Copy link
Owner

Still the same Permission Denied issue, I take it? I'll have to try out node-webkit for my self to find out what is happening, but it seems as other people have successfully used it within nw-containers.

@chukkynze
Copy link

Just in case this may help anyone else, the solution to this kind of problem is basically to adjust your file permissions. Most likely, the file /Users/jacopodaeli/Desktop/PublipingTrainer.app/Contents/Resources/app.nw/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier is not executable by the user/runner of the script. What you can do is to cd to the directory /Users/jacopodaeli/Desktop/PublipingTrainer.app/Contents/Resources/app.nw/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/ and check ls -l for the permissions of terminal-notifier. Most likely, you'll be missing an x in the 4th position, in other words, you don't have executable permissions for this file. run sudo chmod o+x terminal-notifier to give the owner executable permissions. This should solve this problem

@mikaelbr
Copy link
Owner

Very good! Thanks for clearing that up.

@doronsever
Copy link

I'm trying to work with it my self.
When i set my customPath to terminal-notifier.app i get this error:

vendor-48a50c1e.js:25881 Error: spawn EACCES
at exports._errnoException (util.js:1022:11)
at ChildProcess.spawn (internal/child_process.js:313:11)
at exports.spawn (child_process.js:387:9)
at Object.exports.execFile (child_process.js:148:15)

I tried to chmod the file, and even copying the original terminal-notifier.app which comes with node-notifier(which works fine with out customPath)

Any ideas?

@kurisubrooks
Copy link
Collaborator

kurisubrooks commented Jan 19, 2017

@doronsever: EACCES refers to a file being unable to be run, executed or found by the os' file system.

When you set customPath, what path do you give it?
terminal-notifier.app or terminal-notifier.app/Contents/MacOS/terminal-notifier

You need to provide it with the full context of the binary, not just the top level .app (folder)

@doronsever
Copy link

10x @kurisubrooks, you were right...
I haven't seen something pointing at this in the docs but i will relook... 10x!
Now i have a different problem, the 'click' event stopped working. Am i missing something again?

@kurisubrooks
Copy link
Collaborator

Didn't realise this wasn't in the docs, i'll add it soon.
I'll respond to your second question in the appropriate issue.

@doronsever
Copy link

Thank you very much!

@kurisubrooks
Copy link
Collaborator

Added to the docs in 346763c

@mikaelbr
Copy link
Owner

Good 👍 It can also be an absolute path, maybe that should be specified also.

@kurisubrooks
Copy link
Collaborator

I'll update it now.

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

6 participants