我正在尝试在我的本地区域中将节点模块 npm-lazy 作为服务运行。如果我在命令行上运行启动命令它运行良好。我正在运行它:
npm_lazy --config /etc/npm-lazy-config.js
但是,如果想将模块作为服务运行,它会不断收到以下错误消息:
[ Apr 9 01:13:31 Executing start method ("/opt/local/bin/npm_lazy --config /etc/npm-lazy-config.js"). ]
path.js:336
var isAbsolute = path.charAt(0) === '/',
^
TypeError: Cannot call method 'charAt' of undefined
at Object.exports.normalize (path.js:336:27)
at Object.<anonymous> (/opt/local/lib/node_modules/npm_lazy/config.js:2:21)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/opt/local/lib/node_modules/npm_lazy/bin/npm_lazy:37:14)
at Module._compile (module.js:456:26)
[ Apr 9 01:13:32 Stopping because service exited with an error. ]
[ Apr 9 01:13:32 Executing start method ("/opt/local/bin/npm_lazy --config /etc/npm-lazy-config.js"). ]
我用多种方式创建了服务,我将所有目录添加到我创建的 service.xml 中的 envvar 部分,我从中获得
echo $PATH
但似乎找不到 nodejs 的“路径”依赖项。请帮忙。