a
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* 检查浏览器环境
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const { getBrowserPath } = require('../config/browser');
|
||||
|
||||
console.log('🔍 检查浏览器环境...\n');
|
||||
|
||||
const paths = getBrowserPath();
|
||||
console.log('可能的浏览器路径:');
|
||||
paths.forEach((p, i) => {
|
||||
const exists = fs.existsSync(p);
|
||||
console.log(` ${i + 1}. ${p} ${exists ? '✅' : '❌'}`);
|
||||
});
|
||||
|
||||
const found = paths.find(p => fs.existsSync(p));
|
||||
if (found) {
|
||||
console.log(`\n✅ 找到可用浏览器: ${found}`);
|
||||
process.exit(0);
|
||||
} else {
|
||||
console.log('\n❌ 未找到浏览器,请安装:');
|
||||
console.log(' 方式1: npx puppeteer browsers install chrome');
|
||||
console.log(' 方式2: sudo apt-get install chromium-browser');
|
||||
console.log(' 方式3: 设置环境变量 PUPPETEER_EXECUTABLE_PATH=/path/to/chrome');
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user