php 使用 Browsershot 生成pdf文件 报如下错误怎么处理
[0] ProcessFailedException in Browsershot.php line 752
The command "node ^"D:^\phpstudy_pro^\WWW^\gyl^\vendor^\spatie^\browsershot^\src/../bin/browser.js^" ^"^{^\^"url^\^":^\^"file:^\/^\/C:^\^\WINDOWS^\^\1696133718-0190530001708947384^\^\index.html^\^",^\^"action^\^":^\^"pdf^\^",^\^"options^\^":^{^\^"path^\^":^\^".^\/^\u4e00^\u7ebf^\u8fbe^\u901a^\u9001^\u8d27^\u5355_2024010210298515_65.pdf^\^",^\^"args^\^":^[^],^\^"viewport^\^":^{^\^"width^\^":800,^\^"height^\^":600^},^\^"displayHeaderFooter^\^":false,^\^"margin^\^":^{^\^"top^\^":^\^"10px^\^",^\^"right^\^":^\^"8px^\^",^\^"bottom^\^":^\^"10px^\^",^\^"left^\^":^\^"3px^\^"^}^}^}^"" failed.
Exit Code: 1(General error)
Working directory: D:\phpstudy_pro\WWW\gyl\public
Output:
================
Error Output:
================
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'puppeteer'
Require stack:
- D:\phpstudy_pro\WWW\gyl\vendor\spatie\browsershot\bin\browser.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (D:\phpstudy_pro\WWW\gyl\vendor\spatie\browsershot\bin\browser.js:1:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\phpstudy_pro\\WWW\\gyl\\vendor\\spatie\\browsershot\\bin\\browser.js'
]
}
正常生成文件