On Wed, Sep 25, 2013 at 10:58 AM, <[email protected]> wrote:
> Hi all,
>
> I am writing a node.js app using bonescript and am using a systemctl
> service to start it on boot. I have written the service, which correctly
> fires the startup script but it errors out when trying to load bonescript.
> I can run the app from the command line just fine (node app.js) and it
> works, but when called from the service, it gives the following error:
>
> Sep 25 09:42:43 brewbone brewbone[581]: at Function.Module._load
> (module.js:280:25)
> Sep 25 09:42:43 brewbone brewbone[581]: at Module.require
> (module.js:362:17)
> Sep 25 09:42:43 brewbone brewbone[581]: at require (module.js:378:17)
> Sep 25 09:42:43 brewbone brewbone[581]: at Object.<anonymous>
> (/var/lib/cloud9/brewbone/lib/output.js:1:71)
> Sep 25 09:42:43 brewbone brewbone[581]: at Module._compile
> (module.js:449:26)
> Sep 25 09:42:43 brewbone brewbone[581]: at Object.Module._extensions..js
> (module.js:467:10)
> Sep 25 09:42:43 brewbone brewbone[581]: at Module.load (module.js:356:32)
> Sep 25 09:42:43 brewbone brewbone[581]: at Function.Module._load
> (module.js:312:12)
> Sep 25 09:42:43 brewbone brewbone[581]: at Module.require
> (module.js:362:17)
> Sep 25 09:42:43 brewbone brewbone[581]: [96B blob data]
>
>
> My startup script is /user/bin/brewbone:
>
> #!/bin/bash
> nodemon /var/lib/cloud9/brewbone/app.js
>
>
What is 'nodemon'?
>
> The service is /lib/systemd/system/brewbone.service
>
> [Unit]
> Description=Brewbone Application
> After=syslog.target
>
> [Service]
> ExecStart=/usr/bin/brewbone
>
> [Install]
> WantedBy=multi-user.target
>
>
> The suspect line (output.js:1:71) is:
>
> var b = require("bonescript");
>
>
> Any ideas what could be causing the error?
>
See examples on the board for some ideas:
root@beaglebone:/mnt# cat /lib/systemd/system/bonescript-autorun.service
[Unit]
Description=Bonescript autorun
ConditionPathExists=|/var/lib/cloud9
[Service]
WorkingDirectory=/usr/lib/node_modules/bonescript
EnvironmentFile=/etc/default/node
ExecStart=/usr/bin/node autorun.js
SyslogIdentifier=bonescript-autorun
[Install]
WantedBy=multi-user.target
root@beaglebone:/mnt# cat /etc/default/node
NODE_PATH=/usr/lib/node_modules
Most likely, you need to source /etc/default/node in your script to set
NODE_PATH.
If you have a single-file application, you might consider dropping it into
/var/lib/cloud9/autorun as the above autorun.js script will run .js files
dropped into that directory at start-up.
>
> Thanks,
> Josh
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.