当我尝试访问上传到 vercel 服务器的 API 时,出现此错误。
有没有人有同样的错误?
当我在本地运行它时,它工作正常。
2021-02-15T19:38:59.218Z 0109b575-a2e7-478e-aefe-aa3335b5b6b8 错误错误:无法启动浏览器进程!的/ tmp /铬:错误而载入共享库:libnss3.so:无法打开共享对象文件:没有这样的文件或目录故障排除:https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md 在界面上的 onClose (/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)。(/var/task/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:183:68) 在 Interface.emit (events.js:327:22) 在 Interface.close (readline.js: 424:8) at Socket.onend (readline.js:202:10) at Socket.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/进程/task_queues.js:80:21)
代码
import puppeteer, { Page } from 'puppeteer-core'
import chrome from 'chrome-aws-lambda'
export async function getOptions() {
const isDev = !process.env.AWS_REGION
let options;
const chromeExecPaths = {
win32: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
linux: '/usr/bin/google-chrome',
darwin: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
}
const exePath = chromeExecPaths[process.platform]
if (isDev) { …Run Code Online (Sandbox Code Playgroud)