hardcider icon indicating copy to clipboard operation
hardcider copied to clipboard

`ERROR: Failed to download Chromium` when installing

Open Bad-Science opened this issue 7 years ago • 2 comments

Getting this error trying to install via npm. Tried setting the environment variable to skip the chromium download but it didn't seem to have any effect.

macOS: 10.13.6 npm: 5.6.0 node: v8.11.3

$ sudo npm install -g hardcider

Password:
/usr/local/bin/hardcider -> /usr/local/lib/node_modules/hardcider/bin/hardcider.js

> [email protected] install /usr/local/lib/node_modules/hardcider/node_modules/puppeteer
> node install.js

ERROR: Failed to download Chromium r599821! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/hardcider/node_modules/puppeteer/.local-chromium'
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/usr/local/lib/node_modules/hardcider/node_modules/puppeteer/.local-chromium' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Bad-Science avatar Nov 11 '18 22:11 Bad-Science

Looks like this is a Node.js permission issue for global installations - run the following command on your local system to find the value of your npm prefix configuration variable:

$ npm config get prefix

/home/aeksco/npm-global

So if my prefix directory is /home/aeksco/npm-global, I would run the following command to change the owner of that directory:

sudo chown -R aeksco:aeksco /home/aeksco/npm-global

What's happening here? The chown command will change the owner a file or directory. The -R flag recursively changes ownership of all files and sub-directories. The next argument is the user and group that will be the new owner, where the first aeksco is my username, and the second aeksco is the GNU/Linux User Group associated with my user. Lastly the /home/aeksco/npm-global is the path to the directory where ownership will be changed.

@Bad-Science Post an update if that fixes the problem!

aeksco avatar Nov 11 '18 22:11 aeksco

Hmmmm I already tried chown'ing my /usr/local/lib/node_modules and subdirectories, which is where it's trying to create the file. I don't have an npm-global directory anywhere on my machine, and npm config get prefix just returns /usr/local. It seems like this is probably out of this scope for this project now and probably a general issue with installing puppeteer. I'll look more into this when I have a chance and comment back here in case anyone else has a similar problem with puppeteer.

Bad-Science avatar Nov 11 '18 23:11 Bad-Science