Hi there,
I know thats not the real point here to ask a question, because I can't get the ~/.npm/bin/cnc to autostart. I use rc.local and cncjs won't start.
If I start the rc.local manually cncjs starts perfekt!
Can anybody give a hint?
#!/bin/sh -e
/home/.npm/bin/cnc &
exit 0
Regards Christoph
The first line of the cnc script is #!/usr/bin/env node, which is used to locate where Node.js is installed. I guess the PATH variable may not include the search path (e.g. /usr/local/bin or others) for system startup scripts. So you need to make sure the PATH contains that directory before running /home/.npm/bin/cnc. You can find the path as below:
$ echo $PATH
/home/cheton/.nvm/versions/node/v4.4.7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
Assume that /home/cheton/.nvm/versions/node/v4.4.7/bin is the search path, then set the PATH in the startup script:
#!/bin/sh -e
PATH=$PATH:/home/cheton/.nvm/versions/node/v4.4.7/bin
/home/.npm/bin/cnc &
Hope it works for you.
Hi cheton,
thanks for your replay.
Yes. The problem was the PATH.
Now I use the crontab -e for starting something at reboot with following variable:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/pi/.npm/bin/:/usr/local/bin:
@reboot /home/pi/cnc >> /home/pi/cnc.log 2>&1
And it works :)
this says the cnc.log:
Started the server at http://0.0.0.0:8000/.
Thanks for helping so quick :)
Regards Christoph
@slimline33 what commands did you use to install on your pi? I cannot get my'n to autostart without error. See issue #65
Most helpful comment
The first line of the
cncscript is#!/usr/bin/env node, which is used to locate where Node.js is installed. I guess the PATH variable may not include the search path (e.g./usr/local/binor others) for system startup scripts. So you need to make sure the PATH contains that directory before running/home/.npm/bin/cnc. You can find the path as below:Assume that
/home/cheton/.nvm/versions/node/v4.4.7/binis the search path, then set the PATH in the startup script:Hope it works for you.