-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
[BUG] spawn Unknown system error -8 #63
Comments
I downgraded to Node 16.19.1, but now I'm getting:
|
does the file download to |
I'm running a 2.4 GHz 8-Core Intel Core i9 on Mac. Is it because it won't work on Mac? Also, is it supposed to work on Node 18 or only up to Node 16? |
It should support 16 and 18, not sure about 14 since it's EOL in a few weeks. It's compiled specifically for aws lambda, but I don't see any reason why it shouldn't work on the Mac though. |
I'm having a similar error. I'm running this on Netlify dev on a m1 Mac to be pushed as a server less function on Netlify. const puppeteer = require('puppeteer-core');
const chromium = require('@sparticuz/chromium');
exports.handler = async function (event, context) {
if (event.httpMethod === 'OPTIONS') {
return {
statusCode: 200,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Methods': 'POST',
},
body: '',
};
}
const browser = await puppeteer.launch({
args: chromium.args,
executablePath: await chromium.executablePath(),
headless: chromium.headless,
}); Returns me the error of:
|
Getting this error on mac M1 too. When I deploy to a lambda it works using this executablePath: executablePath: await chromium.executablePath(
process.env.AWS_EXECUTION_ENV
? '/opt/nodejs/node_modules/@sparticuz/chromium/bin'
: undefined,
), |
Yeah, the issue for me was that it wasn't compatible with my systems architecture, thus wouldn't work on a local environment. It functions as expected when deployed. Best thing to do is code>deploy>test>code>deploy>test etc. |
@Kal-Toh I've managed to make it work... with playwright. I've installed playwright-core as a dependency and playwright as a devDependency and now it knows how to spawn the browser. I've tried the same solution with puppeteer but I couldn't make it work. const browser = await playwright.chromium.launch({
args: chromium.args,
executablePath: process.env.AWS_EXECUTION_ENV
? await chromium.executablePath(
'/opt/nodejs/node_modules/@sparticuz/chromium/bin',
)
: playwright.chromium.executablePath(),
headless: true
}) |
not working for me either on m1 mac |
Yes, this is the correct way to handle arm at this point. You are saying if I'm running in AWS, use this package, otherwise, use playwright's version of chromium. I'm going to document this and close the multiple issues about running on ARM and running Headfully. Thanks for the insight. |
When running
Do I need to use playwright to execute locally even on x86 architectures? PS.: My setup is running fine when deployed (Layer -> AWS Lambda) |
on M1 you can do a in your terminal prior to running and it should work. You'll need to have the x86 packages installed prior to. You can do it by running this for example
|
Any news how about to execute locally even on M1/M2? |
import chromium from '@sparticuz/chromium-min';
import { executablePath } from 'puppeteer';
import * as puppeteer from 'puppeteer-core';
browser = await puppeteer.launch(
process.env.NODE_ENV === 'production'
? {
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath(
'https://drive.google.com/uc?id=1Sw60gty75maoAr2fsIcu-CDJZ5O8RHrm&export=download',
),
headless: chromium.headless,
ignoreHTTPSErrors: true,
}
: {
headless: false,
executablePath: executablePath(),
},
); For local development I did this and bow it's working. |
I also use the same approach. It works for me as well. But have you experienced the PDF output difference? because sometimes I got an extra page, or some inconsistent styles in the remote/production side. It looks perfect in the local development. |
This happened for me because I was on the new macOS "Apple Silicon" in the terminal Apple will not prompt you to install Rosetta which is required for certain apps to run. Simply running More information about Rosetta here https://support.apple.com/en-gb/HT211861 |
For me it works with next solution
On my side it looks like. import chromium from '@sparticuz/chromium';
import puppeteerCore from 'puppeteer-core';
import puppeteer from 'puppeteer';
...
if (process.env.STAGE === 'local') {
browser = await puppeteer.launch({
executablePath: '/Applications/Chromium.app/Contents/MacOS/Chromium',
args: ['--no-sandbox', '--disable-setuid-sandbox'],
headless: false,
});
console.log('browser', browser);
}
if (process.env.STAGE !== 'local') {
browser = await puppeteerCore.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath(),
headless: chromium.headless,
ignoreHTTPSErrors: true,
});
}
... Mac M1. And from the package.json |
Environment
chromium
Version: chromium-min 110.0.1puppeteer
/puppeteer-core
Version: puppeteer-core 19.6.3Expected Behavior
I tried to run the code here.
Current Behavior
Steps to Reproduce
See above.
The text was updated successfully, but these errors were encountered: