JarvusInnovations / puppeteer-cli

A general command-line wrapper for puppeteer. Currently only supports one command—`print`—to render a local/or remote HTML file to PDF. Aims to be a easy replacement for the deprecated wkhtmltopdf.
MIT License
54 stars 25 forks source link

I can't install it...Why??? #11

Closed martinmurciego closed 4 years ago

martinmurciego commented 4 years ago

sudo npm install -g puppeteer-cli

/usr/local/bin/puppeteer -> /usr/local/lib/node_modules/puppeteer-cli/index.js

puppeteer@1.20.0 install /usr/local/lib/node_modules/puppeteer-cli/node_modules/puppeteer node install.js

ERROR: Failed to download Chromium r686378! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download. { Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/puppeteer-cli/node_modules/puppeteer/.local-chromium' -- ASYNC -- at BrowserFetcher. (/usr/local/lib/node_modules/puppeteer-cli/node_modules/puppeteer/lib/helper.js:111:15) at Object. (/usr/local/lib/node_modules/puppeteer-cli/node_modules/puppeteer/install.js:64:16) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) errno: -13, code: 'EACCES', syscall: 'mkdir', path: '/usr/local/lib/node_modules/puppeteer-cli/node_modules/puppeteer/.local-chromium' } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! puppeteer@1.20.0 install: node install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the puppeteer@1.20.0 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! /home/martin/.npm/_logs/2020-01-11T22_27_48_870Z-debug.log

themightychris commented 4 years ago

For some reason your install process can't write to /usr/local/lib/node_modules/puppeteer-cli/node_modules/puppeteer/.local-chromium

Check out your permissions under there, maybe try deleting everything a couple directories up. I usually see issues like this after some mix of trying to install with and without sudo

You might be able to find more help at the update puppeteer project as the issue is coming from its scripts

martinmurciego commented 4 years ago

npm install -g puppeteer-cli npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] npm ERR! stack: npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR! /home/martin/.npm/_logs/2020-01-12T21_27_11_741Z-debug.log

martinmurciego commented 4 years ago

It was resolved by changing the owner with: sudo chown -R martin / usr / local / lib / node_modules I don't know much about installing npm modules in general, but since installing a deb file, it makes sense to ask for sudo. Now I do not know if I could install as in another directory that does not require these permissions like other linux applications.