Skip to content

The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable. #665

@dineshkumar14062001

Description

@dineshkumar14062001

const pdf = require('html-pdf-chrome');

let options = {
printOptions: {
format: "A4",
landscape: false,
marginTop: marginTop,
marginBottom: marginBottom,
marginLeft: marginLeft,
marginRight: marginRight,
displayHeaderFooter: true,
headerTemplate: headerTpl,
footerTemplate: footerTpl,
},
chromeFlags: ['--headless', '--disable-gpu', '--disable-web-security', '--no-sandbox', '--disable-setuid-sandbox']
};

            let pdfBuffer = await pdf.create(htmlContent, options);
            let buffer = pdfBuffer.toBuffer();
            
            ChromePathNotSetError
at new LauncherError (/home/staruser/staracademy-content/node_modules/html-pdf-chrome/node_modules/chrome-launcher/dist/utils.js:26:22)
at new ChromePathNotSetError (/home/staruser/staracademy-content/node_modules/html-pdf-chrome/node_modules/chrome-launcher/dist/utils.js:33:9)
at Object.linux (/home/staruser/staracademy-content/node_modules/html-pdf-chrome/node_modules/chrome-launcher/dist/chrome-finder.js:128:15)
at Function.getFirstInstallation (/home/staruser/staracademy-content/node_modules/html-pdf-chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:126:51)
at Launcher.launch (/home/staruser/staracademy-content/node_modules/html-pdf-chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:187:43)
at launch (/home/staruser/staracademy-content/node_modules/html-pdf-chrome/node_modules/chrome-launcher/dist/chrome-launcher.js:35:20)
at launchChrome (/home/staruser/staracademy-content/node_modules/html-pdf-chrome/dist/index.js:212:55)
at Object.create (/home/staruser/staracademy-content/node_modules/html-pdf-chrome/dist/index.js:28:24)
at /home/staruser/staracademy-content/routes/services/common-service.js:767:43
at new Promise (<anonymous>)
at Object.generateKatexPdfFile (/home/staruser/staracademy-content/routes/services/common-service.js:723:16)
at /home/staruser/staracademy-content/routes/services/question-answers-service.js:1972:63
at processTicksAndRejections (node:internal/process/task_queues:96:5) {

message: 'The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.',
code: 'ERR_LAUNCHER_PATH_NOT_SET'
}

I have to run in gcp serverless Api
how to solve this error

node version - 16
html-pdf-chrome version - 0.8.4,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions