You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Systemctl启动Node.js应用失败求助(树莓派环境)

Systemctl启动Node.js应用失败求助

我参考相关帖子尝试解决Systemctl启动Node.js应用失败的问题但未成功,现提交问题求助。运行环境为Raspberry Pi,曾参考一篇Node.js应用部署教程。

我的服务文件代码如下:

[Unit]
Description=Node.js Application
After=syslog.target network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root
Enviroment=NODE_ENV=production
ExecStart=/usr/bin/node helloworld.js

Restart=always

[Install]
WantedBy=multi-user.target

出现的错误信息:

helloworld.service: Start request repeated too quickly.
helloworld.service: Failed with result 'exit-code'.
Failed to start Node.js Application

排查建议

  • 服务文件中Enviroment拼写错误,正确应为Environment,该错误会导致环境变量无法正常加载,可能引发启动失败
  • 确认/root/helloworld.js文件存在且权限正常,可执行ls -l /root/helloworld.js检查
  • 验证Node.js路径是否正确,用which node查看实际路径,替换服务文件中的/usr/bin/node
  • 手动运行/usr/bin/node /root/helloworld.js,排查应用本身是否能正常启动(比如代码错误、依赖缺失)
  • 查看详细服务日志定位根因:journalctl -u helloworld.service -f

内容的提问来源于stack exchange,提问作者Owen Odroski

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 22:54:35