1

UPDATE:

The proposed link was the solution to this question. On a Mac you have to make symlink:

sudo ln -s /usr/local/bin/node /usr/bin/node

I wanted to automate some processes on boot of a mac mini. The script should fire up some node.js scripts (forever). The script itself is fired by a launchd process. I have several scripts that work like that. But that one I have a problem:

#!/bin/bash

export PATH=/usr/local/bin
export NODE_ENV=production

cd /Volumes/Services/Proxy
forever -a start /Volumes/Services/Proxy/app.js

This script works pretty fine if executed in the terminal. It makes what it does. But this script throws errors on std.err when launched on boot.

env: node: no such file or directory

First I thought it's a problem because the PATH to "forever" ist not known on startup so I added the export PATH explicitly. It throws the same error when I give the absolute path to "forever":

#!/bin/bash

export NODE_ENV=production

cd /Volumes/Services/Proxy
/usr/local/bin/forever -a start /Volumes/Services/Proxy/app.js

There is no error in the launched.plist file. If I add other content to this script like for example mkdir FOO it does this without problems.

... im not so firm with shell scripting... :(

Anyone knows what I'm doin wrong?

marschro
  • 791
  • 8
  • 23
  • 1
    possible duplicate of [browserify error /usr/bin/env: node: No such file or directory](http://stackoverflow.com/questions/20886217/browserify-error-usr-bin-env-node-no-such-file-or-directory) – Josh Jolly Aug 14 '14 at 08:22
  • 1
    Try to change the explicit `PATH` export to `export PATH=/usr/local/bin:$PATH`, otherwise you're killing what's already in PATH – roelofs Aug 14 '14 at 08:33
  • You can also do an `strace`, and pipe the output to an error log for more detailed information – roelofs Aug 14 '14 at 08:34
  • Launch services is the google search you are looking for – uchuugaka Aug 14 '14 at 09:01
  • 1
    Don't answer the question in the question itself. Either add an answer (you can answer your own question) if the answer is likely to be useful to others, or delete the question altogether. – chepner Aug 14 '14 at 17:34

0 Answers0