const { Client } = require('ssh2'); const conn = new Client(); conn.on('ready', () => { console.log('=== 调试服务器 ==='); // 1. 检查index.html内容 conn.exec('cat /www/huishou/dist/build/h5/index.html', (err, stream) => { if (err) { console.log('ERR:', err); } else { stream.on('data', (d) => console.log('index.html:\n', d.toString())); } stream.on('close', () => { // 2. 检查当前引用的JS文件是否存在 conn.exec('ls -la /www/huishou/dist/build/h5/assets/index-Cz9tJ-qu.js', (err2, stream2) => { if (err2) { console.log('ERR2:', err2); } else { stream2.on('data', (d2) => console.log('主JS文件:', d2.toString())); } stream2.on('close', () => { // 3. 检查weigh页面文件是否存在且有累加代码 conn.exec('ls -la /www/huishou/dist/build/h5/assets/pages-weigh-weigh.DhFJF0hB.js', (err3, stream3) => { if (err3) { console.log('ERR3:', err3); } else { stream3.on('data', (d3) => console.log('weigh文件:', d3.toString())); } stream3.on('close', () => { // 4. 检查Nginx配置 conn.exec('cat /www/server/nginx/conf/vhost/hs.yifenbao.cn.conf', (err4, stream4) => { if (err4) { console.log('ERR4:', err4); } else { stream4.on('data', (d4) => console.log('Nginx配置:\n', d4.toString())); } stream4.on('close', () => conn.end()); }); }); }); }); }); }); }); }); conn.connect({ host: 'hs.yifenbao.cn', port: 22, username: 'root', password: 'Torch1112' });