在 Debian 系统上定位 JavaScript(JS)相关日志 / 故障,通常取决于 JS 运行环境(浏览器、Node.js、前端构建工具等)。下面按最常见场景给你一套系统化的定位思路。
| 场景 | 典型表现 | 日志位置 |
|---|---|---|
| 浏览器端 JS | 页面报错、功能失效 | 浏览器 Console |
| Node.js 服务 | 接口 500、崩溃 | systemd / pm2 / 应用日志 |
| 前端构建 | npm run build 失败 | 终端输出 |
| Nginx + JS 静态资源 | 404 / 500 | nginx 日志 |
F12 → Console
F12 → Network
重点看:
chromium --headless --disable-gpu --dump-dom http://localhost
journalctl -u your-node-service -f
pm2 logs
pm2 show <id>
node app.js
# 或
node --trace-warnings app.js
Cannot find modulelisten EADDRINUSEundefined is not a functionnpm run build
关注:
rm -rf node_modules package-lock.json
npm install
tail -f /var/log/nginx/error.log
tail -f /var/log/nginx/access.log
常见:
# 查看端口
ss -lntp
# 查看进程
ps aux | grep node
# 查看系统日志
dmesg | tail
你可以补充:
cat /etc/os-release)我可以直接帮你分析错误日志或给修复命令。