nodejs / snap

Node.js snap source and updater
MIT License
166 stars 38 forks source link

node 16 via snap fails to install puppeteer but it works with .deb node #25

Open mo opened 2 years ago

mo commented 2 years ago

If I install node using sudo snap install node --classic --channel=16 and then run npm install puppeteer then I get this error:

npm ERR! code 1
npm ERR! path /opt/abc/node_modules/puppeteer
npm ERR! command failed
npm ERR! command sh -c node install.js

...however, if I uninstall the snap version and install via .deb package, then everything works. I.e. it works when I install via:

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
rvagg commented 2 years ago

First I'd try messing with PUPPETEER_DOWNLOAD_PATH (setting it explicitly or via npm config set puppeteer_download_path) https://github.com/puppeteer/puppeteer/pull/6014

See https://github.com/puppeteer/puppeteer/blob/7c0a7b92cf98033425b78e1e7a96bb440a636123/src/node/install.ts#L44-L47

But there might be something here related to child_process spawning .. see https://github.com/nodejs/snap/issues/13#issuecomment-928850443 .. maybe you can use that to work around the problems here?

Basically we're in a constrained environment with Snaps such that certain novel behaviours become problematic. I wish it weren't so but sometimes you're better off just installing Node.js directly and bypassing the containment environment of Snaps.