jef / streetmerchant

🤖 The world's easiest, most powerful stock checker
https://jef.buzz/streetmerchant
MIT License
4.96k stars 1.3k forks source link

[Bug]: Fails to run on M1 Mac (OSX 12.1) #2966

Closed phennessey closed 2 years ago

phennessey commented 2 years ago

Expected Behavior

streetmerchant has run on an Intel Mac before now.

Current Behavior

streetmerchant fails to launch due to a problem with puppeteer / Chromium. It loads the dotenv file just fine, but it crashes after that.

If anyone has a solution, step-by-step instructions would be greatly appreciated! Would be nice if streetmerchant automatically had a built in workaround for this issue. I tried following instructions on other threads, but nothing I did seemed to work.

What operating system are you seeing the problem on?

macOS

Relevant log output

[1:25:34 PM] error :: ✖ something bad happened, resetting streetmerchant in 5 seconds Failed to launch the browser process! spawn /Applications/Chromium.app EACCES

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
 {
  "stack": "Error: Failed to launch the browser process! spawn /Applications/Chromium.app EACCES\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n\n    at onClose (/Users/[username_redacted]/streetmerchant/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:194:20)\n    at ChildProcess.<anonymous> (/Users/[username_redacted]/streetmerchant/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:186:85)\n    at ChildProcess.emit (node:events:390:28)\n    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)\n    at onErrorNT (node:internal/child_process:475:16)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"
}

Configuration

# ** All configuration variables are optional **
# Copy this file and name it as `dotenv` (without backticks)
# Read https://jef.buzz/streetmerchant/getting-started/#customization for help on customizing this file
########################################################################################################

ASCII_BANNER=
ASCII_COLOR=
APNS_AUTHKEY=
APNS_BUNDLEID=
APNS_DEVICETOKEN=
APNS_KEYID=
APNS_PRODUCTION=
APNS_TEAMID=
AUTO_ADD_TO_CART=
BROWSER_TRUSTED=
CAPTCHA_HANDLER_CAPTURE_TYPE=
CAPTCHA_HANDLER_POLL_INTERVAL=
CAPTCHA_HANDLER_RESPONSE_TIMEOUT=
CAPTCHA_HANDLER_SERVICE=
CAPTCHA_HANDLER_TOKEN=
CAPTCHA_HANDLER_USER_ID=
DESKTOP_NOTIFICATIONS=
DISCORD_NOTIFY_GROUP=
DISCORD_NOTIFY_GROUP_3060=
DISCORD_NOTIFY_GROUP_3060TI=
DISCORD_NOTIFY_GROUP_3070=
DISCORD_NOTIFY_GROUP_3070TI=
DISCORD_NOTIFY_GROUP_3080=
DISCORD_NOTIFY_GROUP_3080TI=
DISCORD_NOTIFY_GROUP_3090=
DISCORD_NOTIFY_GROUP_CORSAIR_SF=
DISCORD_NOTIFY_GROUP_RX6800=
DISCORD_NOTIFY_GROUP_RX6800XT=
DISCORD_NOTIFY_GROUP_RX6900XT=
DISCORD_NOTIFY_GROUP_RYZEN5600=
DISCORD_NOTIFY_GROUP_RYZEN5800=
DISCORD_NOTIFY_GROUP_RYZEN5900=
DISCORD_NOTIFY_GROUP_RYZEN5950=
DISCORD_NOTIFY_GROUP_SONYPS5C=
DISCORD_NOTIFY_GROUP_SONYPS5DE=
DISCORD_NOTIFY_GROUP_XBOXSX=
DISCORD_NOTIFY_GROUP_XBOXSS=
DISCORD_NOTIFY_GROUP_TEST=
DISCORD_WEB_HOOK=
EMAIL_PASSWORD=
EMAIL_TO=
EMAIL_USERNAME=
GOTIFY_PRIORITY=
GOTIFY_TOKEN=
GOTIFY_URL=
HEADLESS=
IN_STOCK_WAIT_TIME=
INCOGNITO=
LOG_LEVEL=
LOW_BANDWIDTH=
MAX_PRICE_SERIES_3060=
MAX_PRICE_SERIES_3060TI=
MAX_PRICE_SERIES_3070=
MAX_PRICE_SERIES_3070TI=
MAX_PRICE_SERIES_3080=
MAX_PRICE_SERIES_3080TI=
MAX_PRICE_SERIES_3090=
MAX_PRICE_SERIES_CORSAIR_SF=
MAX_PRICE_SERIES_RX6800=
MAX_PRICE_SERIES_RX6800XT=
MAX_PRICE_SERIES_RX6900XT=
MAX_PRICE_SERIES_RYZEN5600=
MAX_PRICE_SERIES_RYZEN5800=
MAX_PRICE_SERIES_RYZEN5900=
MAX_PRICE_SERIES_RYZEN5950=
MAX_PRICE_SERIES_SONYPS5C=
MAX_PRICE_SERIES_SONYPS5DE=
MAX_PRICE_SERIES_XBOXSS=
MAX_PRICE_SERIES_XBOXSX=
MAX_PRICE_SERIES_TEST=
MICROCENTER_LOCATION=
MQTT_BROKER_ADDRESS=
MQTT_BROKER_PORT=
MQTT_CLIENT_ID=
MQTT_PASSWORD=
MQTT_QOS=
MQTT_TOPIC=
MQTT_USERNAME=
OPEN_BROWSER=
PAGE_BACKOFF_MIN=
PAGE_BACKOFF_MAX=
PAGE_SLEEP_MIN=
PAGE_SLEEP_MAX=
PAGE_TIMEOUT=
PAGERDUTY_INTEGRATION_KEY=
PAGERDUTY_SEVERITY=
PHILIPS_HUE_API_KEY=
PHILIPS_HUE_CLOUD_ACCESS_TOKEN=
PHILIPS_HUE_CLOUD_CLIENT_ID=
PHILIPS_HUE_CLOUD_CLIENT_SECRET=
PHILIPS_HUE_CLOUD_REFRESH_TOKEN=
PHILIPS_HUE_LAN_BRIDGE_IP=
PHILIPS_HUE_LIGHT_COLOR=
PHILIPS_HUE_LIGHT_IDS=
PHILIPS_HUE_LIGHT_PATTERN=
PHONE_CARRIER=
PHONE_NUMBER=
PLAY_SOUND=
PROXY_ADDRESS=
PROXY_PROTOCOL=
PROXY_PORT=
PUSHBULLET=
PUSHOVER_EXPIRE=
PUSHOVER_DEVICE=
PUSHOVER_PRIORITY=
PUSHOVER_RETRY=
PUSHOVER_SOUND=
PUSHOVER_TOKEN=
PUSHOVER_USER=
REDIS_URL=
RESTART_TIME=
SCREENSHOT=
SCREENSHOT_DIR=
SHOW_ONLY_BRANDS=
SHOW_ONLY_MODELS=
SHOW_ONLY_SERIES=
SLACK_CHANNEL=
SLACK_TOKEN=
SMTP_ADDRESS=
SMTP_PORT=
STORES=
TELEGRAM_ACCESS_TOKEN=
TELEGRAM_CHAT_ID=
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_FROM_NUMBER=
TWILIO_TO_NUMBER=
TWITCH_ACCESS_TOKEN=
TWITCH_CHANNEL=
TWITCH_CLIENT_ID=
TWITCH_CLIENT_SECRET=
TWITCH_REFRESH_TOKEN=
TWITTER_ACCESS_TOKEN_KEY=
TWITTER_ACCESS_TOKEN_SECRET=
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_TWEET_TAGS=
STREAMLABS_ACCESS_TOKEN=
STREAMLABS_TYPE=
STREAMLABS_IMAGE=
STREAMLABS_SOUND=
STREAMLABS_DURATION=
FREEMOBILE_ID=
FREEMOBILE_API_KEY=
WEB_PORT=

Code of Conduct

phennessey commented 2 years ago

I was able to get this to work by making a few changes before installing streetmerchant:

brew install --no-quarantine chromium

This installs Chromium without a quarantine in later versions of OSX. This was the problem that kept causing everything to fail.

Then we make a new .zshrc file:

sudo nano ~/.zshrc

Then set the file contents to this:

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=$(which chromium)

Then proceed with the regular streetmerchant installation process.

This works without needing to make any changes to the contents of the dotenv file, or messing around inside the node module folders. Granted, this is a system-wide change since it's relying on .zshrc, but if you're a bit of a noob like me, you are only using npm for streetmerchant and nothing else.

jef commented 2 years ago

Thank you!