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

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined #7085

Closed
haidang666 opened this issue Apr 13, 2021 · 7 comments

Comments

@haidang666
Copy link

Tell us about your environment:

  • Puppeteer version: 8.0.0
  • Platform / OS version: macos
  • URLs (if applicable): any urls
  • Node.js version: 12.21.0

What steps will reproduce the problem?

Please include code that reproduces the issue.

This is related to tsconfig or webpack, cos it works without ts.
The way I use puppeteer

async function getData(url, filePath) {
  const browser = await puppeteer.launch({
    headless: true,
  });
  const page = await browser.newPage();
  await page.goto(url, { waitUntil: 'networkidle0' });
}

What is the expected result?
page loaded

What happens instead?
in electron

index.js:118 TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:117)
    at Object.join (path.js:1039)
    at new BrowserFetcher (BrowserFetcher.js:161)
    at resolveExecutablePath (Launcher.js:441)
    at ChromeLauncher.launch (Launcher.js:78)
    at async getData (src.js:92)

in console

@nuclear/main:     main › renderer › TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
@nuclear/main:     at validateString (internal/validators.js:117:11)
@nuclear/main:     at Object.join (path.js:1039:7)
@nuclear/main:     at new BrowserFetcher (webpack:///./node_modules/@nuclear/core/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js?:161:22)
@nuclear/main:     at resolveExecutablePath (webpack:///./node_modules/@nuclear/core/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js?:441:28)
@nuclear/main:     at ChromeLauncher.launch (webpack:///./node_modules/@nuclear/core/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js?:78:57)
@nuclear/main:     at async getData (webpack:///./node_modules/@nuclear/core/node_modules/extract-sptf-playlist/src.js?:92:19)
@YTvW
Copy link

YTvW commented May 25, 2021

did you manage to fix this? I am running into this issue as well

@haidang666
Copy link
Author

No I didn't, I don't use it with ts

@garethrhughes

This comment has been minimized.

@JiriTrecak
Copy link

Same, getting the issue when trying to run even the simplest script with TS:

(async () => {
  const browser = await puppeteer.launch();
})();

Tried with multiple node versions to no avail. Thank you for any help!

@garethrhughes
Copy link

I was getting this issue because it couldn't locate chromium. I originally had assumed it was expecting a URL when rendering a page from HTML.

@VictorGobel
Copy link

Also having this issue, any news ?

@codydaig
Copy link

Bumping this thread as I am having the exact same issue with no luck.

Running the file directly with ts-node works, but running it within the entire application bundled by webpack fails.

codydaig added a commit to codydaig/puppeteer that referenced this issue Jan 26, 2022
This patch fixes __dirname pointing to / in some envrioments by
trying process.cwd() if __dirname returne undefined.

Issues: puppeteer#7085 puppeteer#7932
OrKoN pushed a commit to codydaig/puppeteer that referenced this issue Feb 7, 2022
This patch fixes __dirname pointing to / in some envrioments by
trying process.cwd() if __dirname returne undefined.

Issues: puppeteer#7085 puppeteer#7932
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

6 participants