I am attempting to use reveal-md to generate slide decks using markdown files. I followed the instructions to install reveal-md using npm npm install -g reveal-md
.
One of the optional dependencies is puppeteer, which is a library that interfaces with Chrome/Chromium API's, and allows the user to print a slide deck to PDF.
reveal-md was installed successfully, but I get this error for puppeteer in my terminal:
ERROR: Failed to download Chromium r549031! Set
"PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: EACCES: permission denied, mkdir
'/usr/lib/node_modules/reveal-md/node_modules/puppeteer/.local-chromium'
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/usr/lib/node_modules/reveal-md/node_modules/puppeteer/.local-chromium' }
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]
(node_modules/reveal-md/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
[email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/reveal-md/node_modules/puppeteer):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
When I installed puppeteer manually via npm install -g puppeteer
, I get a similar error:
ERROR: Failed to download Chromium r588429! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/puppeteer/.local-chromium'
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/usr/lib/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.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-09-13T00_07_56_867Z-debug.log
I even tried promoting myself to the root user and attempting the install command, but I received the same error.
I did a web search for "npm install puppeteer error," and I have seen several comments that this is probably an issue with npm permission. Is there a way I can fix this manually?
UPDATE 9/14/18:
The answer by @rmmcneely, below, is correct to fix my specific error. As a more permanent solution, I followed npm's instructions for changing the global prefix, in the config file, to point to a location I created in my home folder ~/.npm-global
, which solves any permission issues with global packages.
Option 2
- Back-up your computer before you start.
- Make a directory for global installations:
mkdir ~/.npm-global
- Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
- Open or create a
~/.profile
file and add this line:export PATH=~/.npm-global/bin:$PATH
- Back on the command line, update your system variables:
source ~/.profile
- Test: Download a package globally without using
sudo
.npm install -g jshint