Could be an issue with missing modules.
Error: Cannot find module 'puppeteer'
Have you run npm install on the server?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
when i tried to generate a sitemap using laravel-sitemap by spatie team in localhost it gives me an empty sitemap.
$path = public_path('/sitemap.xml');
SitemapGenerator::create(env('APP_URL'))->writeToFile($path);
when upload the file into web server and tried to generate the sitemap it gives me this error:
The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/path/to/project/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"https:\/\/coderflex.com\/","action":"content","options":{"args":[],"viewport":{"width":800,"height":600}}}'" failed. Exit Code: 1(General error) Working directory: /path/to/project/public Output: ================ Error Output: ================ internal/modules/cjs/loader.js:960 throw err; ^ Error: Cannot find module 'puppeteer' Require stack: - /path/to/project/vendor/spatie/browsershot/bin/browser.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15) at Function.Module._load (internal/modules/cjs/loader.js:840:27) at Module.require (internal/modules/cjs/loader.js:1019:19) at require (internal/modules/cjs/helpers.js:77:18) at Object.<anonymous> (/path/to/project/vendor/spatie/browsershot/bin/browser.js:1:19) at Module._compile (internal/modules/cjs/loader.js:1133:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10) at Module.load (internal/modules/cjs/loader.js:977:32) at Function.Module._load (internal/modules/cjs/loader.js:877:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/path/to/project/vendor/spatie/browsershot/bin/browser.js' ] }
any ideas?
Please or to participate in this conversation.