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

Error 4058: Can't even run the Getting started example #2764

Closed
1 task
nicolatournay opened this issue Dec 5, 2024 · 2 comments
Closed
1 task

Error 4058: Can't even run the Getting started example #2764

nicolatournay opened this issue Dec 5, 2024 · 2 comments
Labels
bug Something isn't working. t-tooling Issues with this label are in the ownership of the tooling team.

Comments

@nicolatournay
Copy link

Which package is this bug report for? If unsure which one to select, leave blank

@crawlee/playwright (PlaywrightCrawler)

Issue description

When I run the "Getting started" crawler ("npm start"), I get this obscure error message related to a tool that is deprecated (WMIC) :

my-crawler@0.0.1 start
npm run start:dev

ERROR Memory snapshot failed.
spawn wmic.exe ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
INFO PlaywrightCrawler: Starting the crawler.
node:internal/child_process:286
const err = new ErrnoException(exitCode, syscall);
^

Error: spawn wmic.exe ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn wmic.exe',
path: 'wmic.exe',
spawnargs: [ 'PROCESS', 'GET', 'ProcessId,ParentProcessId,WorkingSetSize,Name' ]
}

Node.js v20.18.0

Code sample

// For more information, see https://crawlee.dev/
import { PlaywrightCrawler } from 'crawlee';

// PlaywrightCrawler crawls the web using a headless
// browser controlled by the Playwright library.
const crawler = new PlaywrightCrawler({
    // Use the requestHandler to process each of the crawled pages.
    async requestHandler({ request, page, enqueueLinks, log, pushData }) {
        const title = await page.title();
        log.info(`Title of ${request.loadedUrl} is '${title}'`);

        // Save results as JSON to ./storage/datasets/default
        await pushData({ title, url: request.loadedUrl });

        // Extract links from the current page
        // and add them to the crawling queue.
        await enqueueLinks();
    },
    // Comment this option to scrape the full website.
    maxRequestsPerCrawl: 20,
    // Uncomment this option to see the browser window.
    // headless: false,
});

// Add first URL to the queue and start the crawl.
await crawler.run(['https://crawlee.dev']);

Package version

crawlee@3.12.1

Node.js version

v20.18.0

Operating system

Windows 11

Apify platform

  • Tick me if you encountered this issue on the Apify platform

I have tested this on the next release

No response

Other context

No response

@nicolatournay nicolatournay added the bug Something isn't working. label Dec 5, 2024
@github-actions github-actions bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 5, 2024
@janbuchar
Copy link
Contributor

Hello @nicolatournay and thank you for your interest in Crawlee! I tried the following steps on windows 11:

scoop install nodejs@20.18.0
npx crawlee create my-crawler
cd my-crawler
npx playwright install
npm start

This worked as expected, without any error. I selected the getting started - typescript template. Then I rechecked with the javascript template and everything worked fine as well.

Is there any other step that I'm missing?

@nicolatournay
Copy link
Author

Hi Jan,

Now that I have added the path to wmic.exe (in my case, C:\Windows\System32\wbem) to my environment variables, it's working as expected.

You might want to include WMIC in the list of prerequisites in the "Setting up" section of your documentation, since it is deprecated for most Windows 11 users.

Anyway, thank you for your quick reply. I’m already enjoying the rest of the tutorial!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. t-tooling Issues with this label are in the ownership of the tooling team.
Projects
None yet
Development

No branches or pull requests

2 participants