Initial commit: Telegram Management System
Some checks failed
Deploy / deploy (push) Has been cancelled
Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
104
check-vite-errors.js
Normal file
104
check-vite-errors.js
Normal file
@@ -0,0 +1,104 @@
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
(async () => {
|
||||
let browser;
|
||||
|
||||
try {
|
||||
console.log('启动浏览器检查Vite错误...');
|
||||
browser = await chromium.launch({
|
||||
headless: false,
|
||||
slowMo: 300
|
||||
});
|
||||
|
||||
const context = await browser.newContext({
|
||||
viewport: { width: 1920, height: 1080 }
|
||||
});
|
||||
|
||||
const page = await context.newPage();
|
||||
|
||||
// 收集所有控制台消息
|
||||
const consoleMessages = [];
|
||||
page.on('console', msg => {
|
||||
const messageObj = {
|
||||
type: msg.type(),
|
||||
text: msg.text(),
|
||||
location: msg.location()
|
||||
};
|
||||
consoleMessages.push(messageObj);
|
||||
|
||||
// 立即打印错误和警告
|
||||
if (msg.type() === 'error' || msg.type() === 'warning') {
|
||||
console.log(`\n${msg.type().toUpperCase()}: ${msg.text()}`);
|
||||
if (msg.location().url) {
|
||||
console.log(`位置: ${msg.location().url}:${msg.location().lineNumber}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 监听页面错误
|
||||
page.on('pageerror', error => {
|
||||
console.log('\n页面错误:', error.message);
|
||||
console.log(error.stack);
|
||||
});
|
||||
|
||||
// 监听网络失败
|
||||
page.on('requestfailed', request => {
|
||||
if (request.url().includes('.ts') || request.url().includes('.vue') || request.url().includes('.js')) {
|
||||
console.log('\n请求失败:', request.url());
|
||||
console.log('失败原因:', request.failure()?.errorText);
|
||||
}
|
||||
});
|
||||
|
||||
// 访问首页
|
||||
console.log('\n访问首页...');
|
||||
await page.goto('http://localhost:5174/', { waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// 打开开发者工具的控制台
|
||||
console.log('\n打开开发者工具...');
|
||||
await page.keyboard.press('F12');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// 刷新页面以捕获所有错误
|
||||
console.log('\n刷新页面...');
|
||||
await page.reload({ waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// 总结所有错误
|
||||
console.log('\n\n========== 错误总结 ==========');
|
||||
const errors = consoleMessages.filter(m => m.type === 'error');
|
||||
const warnings = consoleMessages.filter(m => m.type === 'warning');
|
||||
|
||||
console.log(`错误数量: ${errors.length}`);
|
||||
console.log(`警告数量: ${warnings.length}`);
|
||||
|
||||
if (errors.length > 0) {
|
||||
console.log('\n所有错误:');
|
||||
errors.forEach((err, index) => {
|
||||
console.log(`\n错误 ${index + 1}:`);
|
||||
console.log(err.text);
|
||||
if (err.location.url) {
|
||||
console.log(`文件: ${err.location.url}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 检查Vite错误覆盖层
|
||||
const viteError = await page.locator('.vite-error-overlay').count();
|
||||
if (viteError > 0) {
|
||||
console.log('\n发现Vite错误覆盖层!');
|
||||
const errorText = await page.locator('.vite-error-overlay').textContent();
|
||||
console.log('Vite错误内容:');
|
||||
console.log(errorText);
|
||||
}
|
||||
|
||||
console.log('\n保持浏览器打开,您可以查看控制台...');
|
||||
await new Promise(() => {});
|
||||
|
||||
} catch (error) {
|
||||
console.error('出错了:', error);
|
||||
if (browser) {
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user