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

Can't get it to run on macOS #17

Closed
dmorda opened this issue Jul 3, 2020 · 5 comments
Closed

Can't get it to run on macOS #17

dmorda opened this issue Jul 3, 2020 · 5 comments

Comments

@dmorda
Copy link

dmorda commented Jul 3, 2020

I'm running Node 14.0.0. I cloned the repo, ran npm install and then when I run npm run testpages I get the following error:

✖ npm run test-pages

> speedlify@1.0.0 test-pages /Users/myusername/Desktop/speedlify
> node run-tests

There are no known last run timestamps
First tests for netlify.
Testing 9 sites:
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/myusername/Desktop/speedlify/node_modules/puppeteer/.local-chromium/mac-756035/chrome-mac/Chromium.app/Contents/MacOS/Chromium ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:468:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
    at onErrorNT (internal/child_process.js:468:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /Users/myusername/Desktop/speedlify/node_modules/puppeteer/.local-chromium/mac-756035/chrome-mac/Chromium.app/Contents/MacOS/Chromium',
  path: '/Users/myusername/Desktop/speedlify/node_modules/puppeteer/.local-chromium/mac-756035/chrome-mac/Chromium.app/Contents/MacOS/Chromium',
  spawnargs: [
    '--disable-features=TranslateUI',
    '--disable-extensions',
    '--disable-component-extensions-with-background-pages',
    '--disable-background-networking',
    '--disable-sync',
    '--metrics-recording-only',
    '--disable-default-apps',
    '--mute-audio',
    '--no-default-browser-check',
    '--no-first-run',
    '--disable-backgrounding-occluded-windows',
    '--disable-renderer-backgrounding',
    '--disable-background-timer-throttling',
    '--force-fieldtrials=*BackgroundTracing/default/',
    '--remote-debugging-port=64870',
    '--user-data-dir=/var/folders/mg/0w3s95hd5dxdm7wdzq3bs8rw0000gn/T/lighthouse.XXXXXXX.X48A6iwi',
    '--headless',
    'about:blank'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! speedlify@1.0.0 test-pages: `node run-tests`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the speedlify@1.0.0 test-pages script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/myusername/.npm/_logs/2020-07-03T14_11_34_994Z-debug.log

Known issue or am I doing something wrong?

@zachleat
Copy link
Owner

zachleat commented Jul 3, 2020

Sorry to ask this but did you npm install?

@dmorda
Copy link
Author

dmorda commented Jul 3, 2020

No worries, fair question.

I did the git clone and then npm install. After that, I ran npm run test-pages.

I think it's telling me the path to the Chromium app is not there, which upon inspection is correct.

/Users/myusername/Desktop/speedlify/node_modules/puppeteer/.local-chromium/mac-756035/chrome-mac/Chromium.app/Contents/MacOS/Chromium

There is no MacOS path under that folder.

ls /Users/myusername/Desktop/speedlify/node_modules/puppeteer/.local-chromium/mac-756035/chrome-mac/Chromium.app/Contents

The only folder under Content is "Frameworks".

@zachleat
Copy link
Owner

zachleat commented Jul 9, 2020

Huh—I’m going to ask another dumb question here—are you on node 14.0.0?

I’m seeing 14.5 as the latest and it seems to work here (on Mac OS Catalina)

image

@dmorda
Copy link
Author

dmorda commented Jul 9, 2020

As it turns out, I dug into this yesterday and was able to get it working. I would do an npm install and everything seemed to be installed correctly. The only output that was potentially related was this.

npm WARN axe-puppeteer@1.1.0 requires a peer of puppeteer@^1.10.0 || ^2.0.0 but none is installed. You must install peer dependencies yourself.

After I did the npm install and ran npm test-pages I would get this error:

Error: spawn /Users/dmorda/Desktop/speedlify/node_modules/puppeteer/.local-chromium/mac-756035/chrome-mac/Chromium.app/Contents/MacOS/Chromium ENOENT

That indicated that Chromium wasn't in the right place so I looked into it. Here's the output of the .local-chromium directory.

$ pwd && ls -la
/Users/dmorda/Desktop/speedlify/node_modules/puppeteer/.local-chromium
total 262184
drwxr-xr-x   4 dmorda  staff        128 Jul  9 06:57 .
drwxr-xr-x  12 dmorda  staff        384 Jul  9 06:54 ..
-rw-r--r--   1 dmorda  staff  130132645 Jul  9 06:57 chrome-mac.zip
drwxr-xr-x   3 dmorda  staff         96 Jul  9 06:57 mac-756035

What seemed to be happening is that puppeteer would be installed during the npm install process, but the zip file was not being extracted correctly. The Chromium.app seemed to be corrupt in some way. So I unzipped chrome-mac.zip and then replaced the corrupt Chromium.app.

Once I did the above, all worked as expected. Since nobody else reported this, it's probably my local environment so I'm going to go ahead and close this one.

@dmorda dmorda closed this as completed Jul 9, 2020
@zachleat
Copy link
Owner

zachleat commented Jul 9, 2020

Thank you for the update!

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

2 participants