New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install -g puppeteer fails #375

Closed
umpox opened this Issue Aug 18, 2017 · 16 comments

Comments

Projects
None yet
@umpox

umpox commented Aug 18, 2017

npm install -g puppeteer returns the following error: Download failed: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/puppeteer/.local-chromium'

Is this expected? I am using it as a dependency of a project I would like to install globally and this is blocking that.

@joelgriffith

This comment has been minimized.

Contributor

joelgriffith commented Aug 18, 2017

Seems like your global modules are being installed in a place that requires some elevated access. Have you had EACCES issues before? Might consider having global modules installed in a less sensitive place (https://medium.com/@sifium/using-npm-install-without-sudo-2de6f8a9e1a3). Otherwise you might need sudo...

@Garbee

This comment has been minimized.

Contributor

Garbee commented Aug 18, 2017

You shouldn't install things globally because they are dependencies. Packages when you install will install all of their dependencies internally. Only install things globally when you use them in your OS level tooling. And even then, quite a bit of tools like eslint and stylelint are well thought through in most tools to not need global installs of them.

You'd need to do sudo here though if you really wanted to do it, because /usr requires elevated permission to read/write to. But once again, don't do this. It's bad for your health later in life.

@aslushnikov

This comment has been minimized.

Contributor

aslushnikov commented Aug 18, 2017

I am using it as a dependency of a project I would like to install globally and this is blocking that.

This might be an issue in the installation script that uses default umask for directory creation. I'll take a look.

@aslushnikov

This comment has been minimized.

Contributor

aslushnikov commented Sep 9, 2017

Looks like this is related to npm permissions

@snoopdouglas

This comment has been minimized.

snoopdouglas commented Nov 13, 2017

This could've been caused by an npm bug that was fixed in: https://github.com/npm/npm/releases/tag/v5.4.1

@donaldpipowitch

This comment has been minimized.

donaldpipowitch commented Jan 30, 2018

Hmm... I use Win 10 with WSL and start getting these every now and then.
E.g. I run yarn in a new project which uses puppeteer and later I run yarn again I currently get An unexpected error occurred: "EIO: i/o error, unlink '/mnt/c/Users/foo/workspace/ui.form/node_modules/puppeteer/.local-chromium/linux-508693/chrome-linux/chrome'. I'll try to investigate further.

@kat-whittenburg

This comment has been minimized.

kat-whittenburg commented Feb 6, 2018

This command ended up working for me, in case anyone lands here by googling the error:

sudo npm install -g puppeteer --unsafe-perm=true

@captyoungkyu

This comment has been minimized.

captyoungkyu commented Feb 21, 2018

sudo npm i npm@4 -g

If someone does not work,
use npm@4.6.1 and it will work.
(In my case it worked perfectly.)

@danopia

This comment has been minimized.

danopia commented Mar 25, 2018

The --unsafe-perm flag lets Puppeteer-based tools install with sudo, but afterwards I'm having problems running the program:

$ my-stupid-tool
Launching Puppeteer...
Failed Error: spawn EACCES
    at ChildProcess.spawn (internal/child_process.js:330:11)
    at Object.exports.spawn (child_process.js:500:9)
    at Function.launch (/usr/lib/node_modules/oracle-cli/node_modules/puppeteer/lib/Launcher.js:106:40)
    at <anonymous>

And sudo my-stupid-tool seems to annoy Chromium and launching just times out.

Is telling users to not use system-wide node the only option here?

@rlue rlue referenced this issue Apr 9, 2018

Closed

Error installing #22

@greg-benner-klick-sensei

This comment has been minimized.

greg-benner-klick-sensei commented Jul 10, 2018

Still a bug with npm 6.1.0 && node 10.6.0 on Ubunutu 18.10
but can confirm the workaround is #375 (comment)

@vkentta

This comment has been minimized.

vkentta commented Jul 11, 2018

As @aslushnikov stated earlier, this is indeed related to npm permissions and fixing those gets rid of the error. In my case puppeteer was installed as a regular project dependency and fixing the npm permissions solved the problem.

@greg-benner-klick-sensei

This comment has been minimized.

greg-benner-klick-sensei commented Jul 11, 2018

I'm not sure that was the issue, I'm using NVM which sets correct npm package permissions (to my knowledge) but I could be wrong.

mtwalsh added a commit to enovatedesign/php-craft that referenced this issue Jul 25, 2018

@much-rebel

This comment has been minimized.

much-rebel commented Aug 6, 2018

I'm using docker and amazonlinux image. Everything runs on root there as no one has time to bother, it's docker and it's for dev. But this error still occurs, npm perm fix has nothing to do with it in my case, also as in comment mentioned --unsafe-perm makes it pass thru install, but breaks the library usage.

npm -v: 5.6.0
node -v: v8.11.3

Docker file to reproduce:

FROM amazonlinux:2018.03.0.20180622

RUN curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -

RUN REQUIREMENTS="\
  gcc-c++ \
  make \
  nodejs" \
  && yum install $REQUIREMENTS -y

RUN npm i -g codeceptjs@^1.2.1 puppeteer@^1.4.0

Build command: docker build - < Dockerfile

@stavvie34

This comment has been minimized.

stavvie34 commented Aug 9, 2018

I believe this is an issue with permissions via NPM. I'm also using nvm with node 8.11.3 LTS, and npm 6.3.0 on a Mac.

@kat-whittenburg 's solution was what worked for me, as it bypasses the permissions. I was doing this locally however, so it still works if you omit the global flag.

sudo npm install puppeteer --unsafe-perm=true.

Thank you @kat-whittenburg !

Not a permanent fix, as I still run into permission errors on other packages (I've tried reseting everything, and I think it may have to do with using your fingerprint as a user access), but it works for individual items!

@jokenox

This comment has been minimized.

jokenox commented Sep 23, 2018

Try with:
sudo su
sudo npm i puppeteer (or with -g)
Yeah, both times with "sudo".

robertdebock added a commit to robertdebock/docker-revealmd that referenced this issue Sep 26, 2018

Update Dockerfile
Found a [similar problem](GoogleChrome/puppeteer#375 (comment)) with a solution.

olbat added a commit to olbat/dockerfiles that referenced this issue Oct 20, 2018

olbat added a commit to olbat/dockerfiles that referenced this issue Oct 20, 2018

@salsa-dev

This comment has been minimized.

salsa-dev commented Nov 13, 2018

#375 (comment) works for me with no side effects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment