Skip to content
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

PUPPETEER_SKIP_CHROMIUM_DOWNLOAD not respected in NPM Config #2270

Closed
alixaxel opened this issue Mar 27, 2018 · 10 comments

Comments

@alixaxel
Copy link
Contributor

@alixaxel alixaxel commented Mar 27, 2018

Environment:

  • Puppeteer version: 1.2.0
  • Platform / OS version: Ubuntu 16.04 LTS
  • Node.js version: 8.10.0 (NPM 5.6.0)

What steps will reproduce the problem?

  1. Add puppeteer as a dependency in package.json.
  2. In the same level as package.json, create a .npmrc file.
  3. Set the content of .npmrc to PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = "1".
  4. Run npm install.

What is the expected result?

Puppeteer should skip Chromium download, according to:

https://github.com/GoogleChrome/puppeteer/blob/a363a733b7aa88be9a17190bcfa924b507d7b3da/install.js#L19-L26

What happens instead?

Chromium is downloaded regardless.

@AndreasZeiser

This comment has been minimized.

Copy link

@AndreasZeiser AndreasZeiser commented Mar 31, 2018

You should use the lower cased version of PUPPETEER_SKIP_CHROMIUM_DOWNLOAD in .npmrc. puppeteer_skip_chromium_download=true works for me.

@alixaxel

This comment has been minimized.

Copy link
Contributor Author

@alixaxel alixaxel commented Mar 31, 2018

@AndreasZeiser Ah, it works! Thanks for this insight. 👍

@pribilinskiy

This comment has been minimized.

Copy link

@pribilinskiy pribilinskiy commented Jul 24, 2018

@AndreasZeiser is there any explanation on why it should be lowercased?

@AndreasZeiser

This comment has been minimized.

Copy link

@AndreasZeiser AndreasZeiser commented Jul 24, 2018

@pribilinskiy I can't remember exactly but I think it's because inside npm-scripts Node prefers the lowercase version. More info here: https://docs.npmjs.com/misc/config#environment-variables

@sapanprajapati

This comment has been minimized.

Copy link

@sapanprajapati sapanprajapati commented Jul 24, 2018

Simply do this.
npm config set puppeteer_skip_chromium_download true -g
working for me like charm :)

bakorer added a commit to codenote-net/serverless-crawler that referenced this issue Dec 20, 2018
- doc: [https://docs.npmjs.com/files/npmrc.html](https://docs.npmjs.com/files/npmrc.html)
- [PUPPETEER_SKIP_CHROMIUM_DOWNLOAD not respected in NPM Config · Issue #2270 · GoogleChrome/puppeteer](puppeteer/puppeteer#2270 (comment))
@icfantv

This comment has been minimized.

Copy link

@icfantv icfantv commented Apr 19, 2019

For anyone else coming here, by default, it appears that the default file for npm config set ... is ~/.npmrc. However, it also appears that if you put an .npmrc file in the root folder of your repo and put puppeteer_skip_chromium_download=true in that file, NPM sets it, and thus, the puppeteer install respects it. From my yarn install log:

[5/5] Building fresh packages...
verbose 13.216 **INFO** Skipping Chromium download. "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" was set in npm config.
@raDiesle

This comment has been minimized.

Copy link

@raDiesle raDiesle commented Sep 25, 2019

adding it to .npmrc has no effect when using
npm ci
but
npm install works

this seems to be a bug.

environment:
Windows 10
puppeteer v1.19.0

@icfantv

This comment has been minimized.

Copy link

@icfantv icfantv commented Nov 21, 2019

@DaveJarvis what's the context around using sudo and exit? You shouldn't need that to edit a file in your own, home directory. I.e., the echo command should suffice on its own.

@icfantv

This comment has been minimized.

Copy link

@icfantv icfantv commented Nov 22, 2019

If I'm being honest, something is very strange with your setup. I'm not saying you didn't have to do what you did to get it to work for you. But something is very, very strange. When you do a sudo su - it logs you in as the root user. According to NodeJS' own documentation, there is no mention of the root user needing to control an .npmrc file.

@DaveJarvis

This comment has been minimized.

Copy link

@DaveJarvis DaveJarvis commented Nov 22, 2019

Here's how I addressed the issues. First, update .bashrc with:

export NPM_GLOBAL_HOME=$HOME/.npm-global
export PATH="$PATH:${NPM_GLOBAL_HOME}/bin"

Then, after launching a new terminal:

mkdir -p "${NPM_GLOBAL_HOME}"
npm config set prefix "${NPM_GLOBAL_HOME}"
npm config set registry http://registry.npmjs.org/  

At this point, running npm install -g or npx install worked as a regular user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.