ScreenshotNeo

BlogHow-to

How to Run Puppeteer Screenshots on an Indian Shared Hosting Plan

Puppeteer can run on shared hosting only if the provider supports its browser, libraries, permissions and workload. Check your plan before installing.

By the ScreenshotNeo team4 October 202610 min read

Puppeteer screenshots can run on an Indian shared hosting plan only when that specific plan supports the browser runtime and launch conditions Puppeteer needs. The server must provide a compatible Node.js version, Chrome for Testing and its Linux shared libraries, writable browser-cache and temporary-profile paths, a supported sandbox configuration, and enough resources for the actual screenshot workload. A Node.js selector in cPanel does not guarantee headless Chrome is supported.

Start by asking the host about the exact plan. If it cannot confirm Chrome support or the smoke test below fails for a provider-controlled reason, compare a managed Node.js plan or VPS and verify its current limits before moving. The server’s location in India does not determine compatibility.

1. Check your hosting plan before installing Puppeteer

Contact the provider with these questions, and keep the answers with your account notes:

  • Which Node.js versions are enabled for this exact plan? Are they available in the runtime context where the app or scheduled job will run?
  • Does the plan explicitly allow Puppeteer with Chrome for Testing or chrome-headless-shell?
  • Are the Linux shared libraries Chrome requires installed?
  • How is Chrome’s sandbox handled under the account’s security restrictions? Is there a supported configuration?
  • Can the account write to a persistent browser cache, a temporary user-data directory, the application’s output directory, and the system or account temporary directory?
  • What are the memory, CPU, process-count, execution-time, disk-space, and concurrency limits?
  • Are long-running processes, queues, cron jobs, and background screenshot tasks permitted?

On cPanel, Node.js application support and Passenger setup depend on the hosting provider. cPanel says Node.js appears in the interface only when the provider enables it, and its installation documentation lists packages providers need to install. Ask the host to confirm browser automation itself, not just Node.js access: cPanel’s Node.js installation documentation.

2. Match Node.js and Puppeteer versions

Check the requirements for the exact Puppeteer version in your application’s lockfile. The retrieved Puppeteer requirements for version 25.12.0 list Node.js 22.12 or later. That number is not a universal requirement for all Puppeteer versions; use the matching version’s requirements and confirm the host exposes a compatible runtime.

Also check the documented Linux distribution and CPU architecture requirements for that Puppeteer release. A package can install successfully while the browser still fails to launch because the operating system, architecture, or libraries do not match. See Puppeteer’s documentation for the version you plan to deploy.

3. Install Puppeteer and plan for browser storage

Puppeteer downloads Chrome for Testing and chrome-headless-shell by default. Its installation guide reports an approximately 282 MB Linux Chrome for Testing download. That is the browser download size, not the total disk space required: your application dependencies, browser cache, temporary profile, screenshots, and logs need additional room.

The default browser cache is under the user’s home directory. If that path is unavailable or unsuitable on the host, set a writable cache directory using Puppeteer’s configuration or the PUPPETEER_CACHE_DIR environment variable. Confirm the cache path and the temporary user-data/profile path are writable by the same account that runs the app.

npm install puppeteer

If the deployment environment blocks package install scripts, use Puppeteer’s documented browser-install command explicitly, then confirm that the browser was downloaded into the cache location the running app will use:

npx puppeteer browsers install

Use the install command documented for your installed Puppeteer version. Do not assume a successful npm install means the browser binary or all system libraries are present.

4. Run a minimal screenshot smoke test

Run this from the same account and Node.js runtime context as your hosted application. Change the output path to a directory your app can write to, and use a URL you are authorized to access. This is a diagnostic script, not a claim that every shared host supports Chrome.

// screenshot-smoke-test.mjs
import puppeteer from 'puppeteer';

const targetUrl = 'https://example.com';
const outputPath = './screenshot.png';
let browser;

try {
  browser = await puppeteer.launch({
    // Set executablePath only if your provider gives you a supported browser path.
    // Set userDataDir to a writable, per-job or per-process directory if needed.
    headless: true,
  });

  const page = await browser.newPage();
  await page.setViewport({ width: 1280, height: 800, deviceScaleFactor: 1 });
  await page.goto(targetUrl, {
    waitUntil: 'networkidle2',
    timeout: 45000,
  });
  await page.screenshot({ path: outputPath, type: 'png' });
  console.log(`Saved ${outputPath}`);
} catch (error) {
  console.error('Screenshot smoke test failed:', error);
  process.exitCode = 1;
} finally {
  if (browser) await browser.close();
}

If the target keeps connections open, networkidle2 may time out even though the page is usable. For a diagnostic, try waitUntil: 'domcontentloaded' and then wait for a selector that indicates the content is ready. Avoid increasing timeouts blindly; first identify whether the failure is navigation, browser launch, a missing library, permissions, or a provider limit.

5. Capture a page reliably

After the smoke test works, adapt the script to the page and workload. The central choices are when navigation is considered complete, what content must be ready, what viewport is captured, and whether the screenshot is a viewport or full-page image.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({ headless: true });
try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1440, height: 900, deviceScaleFactor: 1 });

  await page.goto('https://example.com', {
    waitUntil: 'domcontentloaded',
    timeout: 45000,
  });
  await page.waitForSelector('main', { timeout: 15000 });
  await page.screenshot({
    path: './page.png',
    type: 'png',
    fullPage: true,
  });
} finally {
  await browser.close();
}

waitUntil can use load, domcontentloaded, networkidle0, or networkidle2. Pages with analytics, streaming, or persistent requests may never become network-idle, so waiting for a meaningful selector is often more reliable. For lazy-loaded images on a long page, scrolling through the page before capture may be necessary; that adds time and memory use.

For one element instead of the page, wait for it and pass its handle to screenshot:

const card = await page.waitForSelector('.product-card', { timeout: 15000 });
await card.screenshot({ path: './product-card.png', type: 'png' });

Use fullPage: true for the full document, and a regular screenshot for the current viewport. High device scale factors produce sharper images but increase image dimensions, encoding work, memory use, and output size. Keep browser and page lifetimes bounded, and close them in a finally block so errors do not leave processes consuming a shared plan’s quota.

6. Handle sandboxing safely

Do not use --no-sandbox as the routine fix for a shared-hosting launch error. Puppeteer’s troubleshooting documentation explains that the Chrome sandbox protects the host from untrusted web content and says, “Running without a sandbox is strongly discouraged.” On shared hosting, the provider may control the kernel and account-level security settings. Ask the provider which sandbox configuration it supports and follow its policy.

If the provider cannot support Chrome’s sandbox requirements for your account, choose an environment that does. A command-line flag that makes a browser start can weaken isolation, which matters when the browser visits web content you do not fully control.

7. Diagnose common failures

Symptom Likely cause What to check or do
Browser executable missing The browser download did not run, the cache is elsewhere, or the runtime user cannot see it. Run Puppeteer’s browser install command for the installed version. Confirm the configured cache path and permissions for the app’s runtime account.
Error mentions a missing shared object or library A Chrome Linux dependency is absent from the server. Copy the exact missing-library name to the host and ask whether it can be installed for the plan. Shared-hosting users often cannot add system packages themselves.
Permission denied while launching or writing The browser cache, temporary profile, or output path is not writable by the application account. Use account-owned writable paths; check permissions and ownership for the runtime user. Avoid relying on a shell session that runs as a different user.
Chrome exits immediately or reports a sandbox error The host’s security policy does not permit the launch configuration. Ask support for the plan’s supported sandbox configuration. Do not treat disabling the sandbox as a default production fix.
Works over SSH but fails in the hosted app The app uses a different Node.js binary, environment variables, account, working directory, or process policy. Log process.version, the resolved cache and output paths, and the runtime user from the app context. Compare those with the successful shell context.
Navigation or screenshot times out The target is slow, waits for persistent network traffic, blocks the host, or exceeds the provider’s execution limit. Try domcontentloaded plus a target-specific selector; confirm the URL is reachable from the server and ask about execution limits. Keep the timeout within the host’s allowed runtime.
Process is killed or the server becomes unstable Browser memory, CPU, process count, or concurrency exceeds the plan allowance. Test one job at a time, reduce viewport, scale, and page length, close each browser, and ask the provider for account limits before adding concurrency.
Install succeeds but launch fails after deployment Production and build environments use different architectures, library sets, cache paths, or install-script policies. Install and launch under the deployed runtime where possible. Compare architecture, Puppeteer version, browser cache, and OS dependencies.

8. Size the workload and keep costs predictable

There is no universal CPU or RAM minimum established for a Puppeteer screenshot on shared hosting. The page being captured, browser version, viewport, full-page dimensions, device scale, number of simultaneous pages, and host quotas all affect resource use. Check the provider’s current dashboard and terms, then measure representative pages under the same runtime and concurrency you intend to use.

  • Begin with one browser job at a time; increase concurrency only after observing that it fits the plan’s limits.
  • Reuse a browser process only if the provider permits persistent processes and you can reliably close pages and recover from browser crashes. Otherwise, short-lived jobs are simpler but pay browser startup cost each time.
  • Set bounded navigation and selector timeouts. Record failures and close browser resources on every path.
  • Limit full-page and high-resolution captures to cases that need them; both can increase memory, processing time, and storage.
  • Track browser cache, temporary profiles, screenshots, and logs against disk quotas. Delete temporary data according to your retention needs.
  • Check whether the host allows scheduled jobs, background workers, and the expected request frequency. A plan suitable for occasional manual captures may not suit a continuous screenshot service.

For reliability, test the pages that represent your real workload, including slow pages and pages with long-running requests. Treat CAPTCHA or bot checks as a target-site restriction, not a reason to repeatedly retry. Keep access credentials out of logs and do not capture pages you are not authorized to access.

9. Decide whether to stay, upgrade, or move

Stay on the shared plan only if the provider confirms browser support and the real workload fits its documented resource and job limits. Compare a managed Node.js plan or VPS when the current plan lacks browser libraries, launch permission, storage, or reliable process capacity. For either option, verify the exact service rather than inferring Puppeteer compatibility from a product label.

Check Why it matters
Node.js version, Linux distribution, and architecture Must match the requirements of your Puppeteer release and browser build.
Browser binaries and shared libraries The package needs a compatible browser and its operating-system dependencies.
Sandbox policy and configuration access Chrome must launch under a security setup the host supports.
Writable cache, profile, output, and storage Browser installation and captures need persistent or temporary disk space.
CPU, memory, processes, duration, and concurrency These limits determine whether representative pages finish reliably.
Background and scheduled job policy Screenshot workloads may run outside a normal web request.
Total cost and operational effort Include plan charges, storage, maintenance, and time spent managing the browser environment.

Hostinger’s India site provides an example of the distinction between managed Node.js hosting and VPS control. It is not proof that a named plan supports Puppeteer. Confirm current features and limits with the provider before switching: Hostinger’s India VPS information.

Or skip the browser setup

If your shared host cannot install or launch Chrome, you can send the URL to ScreenshotNeo, a website screenshot API and MCP server by Yorker Media. The one-call API returns an image or PDF, and its documentation describes the available options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server lets AI agents such as Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for 1,000 free screenshots a month with no card.

FAQ

Does being hosted in India affect whether Puppeteer works?

No. Compatibility depends on the plan’s runtime, operating-system packages, permissions, security policy, and resource limits.

Does a cPanel Node.js option mean Chrome is supported?

No. It confirms only that the provider enabled Node.js support. Ask separately about Chrome for Testing, libraries, sandboxing, and job limits.

Can I use Puppeteer without downloading Chrome?

Only if a compatible browser is already available and Puppeteer is configured to use its executable path. Ask the provider whether that browser and path are supported.

Should I use a VPS for every screenshot project?

No. Move when the shared plan cannot meet the verified browser requirements or workload. A VPS also needs suitable libraries, configuration, resources, and maintenance.