Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createScraper Fails to Recognize executablePath #790

Open
shaimalul opened this issue Jun 5, 2023 · 3 comments
Open

createScraper Fails to Recognize executablePath #790

shaimalul opened this issue Jun 5, 2023 · 3 comments

Comments

@shaimalul
Copy link

While integrating executablePath into the createScraper function, an error is encountered:

const executablePath = await getChromiumExecutablePath();
const options: ScraperOptions = {
  companyId: companyType,
  startDate,
  combineInstallments: false,
  showBrowser: false,
  executablePath,
};
const scraper = createScraper(options);

The executablePath value typically is like: my-project\node_modules\download-chromium/.local-chromium/chromium-win64-843427/chrome-win/chrome.exe.

However, this error is thrown: scraping failed for the following reason: Error: ENOENT: no such file or directory, mkdtemp 'undefined\temp\puppeteer_dev_chrome_profile-XXXXXX'.

Below is the getChromiumExecutablePath function:

import { getPuppeteerConfig } from 'israeli-bank-scrapers-core';
import Logging from '../library/Logging';

const download = require('download-chromium');

export async function getChromiumExecutablePath(): Promise<string> {
  const chromiumRevision = getPuppeteerConfig().chromiumRevision;
  Logging.info(`chromiumRevision: ${chromiumRevision}`);
  let path;
  try {
    path = await download({
      revision: chromiumRevision,
    });
  } catch (error) {
    Logging.error(`Error on downloading chrome: ${error}`);
  }
  Logging.info(`path: ${path}`);
  return path;
}

Expected Behavior:
The createScraper function should recognize and accept the executablePath supplied without throwing the error above.

Current Behavior:
Currently, the createScraper function throws an error when executablePath is provided.

Potential Solutions or Suggestions:
Could this be a file path issue related to Chromium's installation directory, or perhaps an issue with download-chromium? Any insights or suggestions would be much appreciated.

@esakal
Copy link
Collaborator

esakal commented Jun 17, 2023

Hello,
Sorry for the late response. Can you reply with the value you got from

  path = await download({
      revision: chromiumRevision,
    });

@niv280
Copy link

niv280 commented Jun 17, 2023

I got the same issue the path var for me is:
/home/ni/test/node_modules/download-chromium/.local-chromium/chromium-linux-843427/chrome-linux/chrome

@shaimalul
Copy link
Author

@esakal locally is the path:
temp/chromium-win64-843427/chrome-win/chrome.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants