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

RuntimeError: npm dependencies failed to install - Proxy & Private npm registry issues #7660

Closed
BlueCog opened this issue Dec 19, 2019 · 3 comments · Fixed by #8455
Closed
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

Comments

@BlueCog
Copy link

BlueCog commented Dec 19, 2019

Environment

Description

When trying to activate a JupyterLab extension, for example jupyterlab-manager by running the following command:

jupyter labextension install '@jupyter-widgets/jupyterlab-manager@^1.1'

I'm getting a RuntimeError: npm dependencies failed to install error.

Reproduce

Reproducing is a bit complex due our environment. But i'll try to explain:

Environment: OpenShift
Based on: https://github.com/jupyter-on-openshift/jupyter-notebooks/tree/develop/minimal-notebook
Ref: 2.5.1.

The environment is behind an Proxy
The environment has a private NPM & PIP repository
Proxy settings are being set by using environment variables: HTTPS_PROXY, npm_config_registry, PIP_CONFIG_FILE.

Troubleshooting

After running the command with a --debug: jupyter labextension install '@jupyter-widgets/jupyterlab-manager@^1.1' I found out that Yarn is used to install npm dependencies.

Yarn seems not to be setting the npm config environment variables (1). So I think Yarn is depending on the default (public) NPM registry. Which is not reachable from our environment.

Expected behavior

I'll be expecting to be able to set a Yarn proxy or registry by setting:
--proxy
--https-proxy
--registry

preferably via environment variables like npm (1) and because this is an docker environment.

Something like:
ret = self._run(['node', YARN_PATH, 'install', '--proxy NPM_CONFIG_PROXY' , '--https-proxy NPM_CONFIG_HTTPS-PROXY', '--registry NPM_CONFIG_REGISTRY', '--non-interactive'], cwd=staging)

From te source code:

ret = self._run(['node', YARN_PATH, 'install', '--non-interactive'], cwd=staging)

Context

OpenShift
RHEL based image
notebook==6.0.2
jupyterhub==1.0.0
jupyterlab==1.2.3
jupyter_kernel_gateway==2.4.0

(1) https://docs.npmjs.com/misc/config#environment-variables

@BlueCog
Copy link
Author

BlueCog commented Feb 10, 2020

Hi all,

Please let me know if I need to add another ticket, or on how to add (tag users?) an request to change this.

After some extensive troubleshooting we noted that even by adding config files (or flags) to configure private repositories or proxy the build is still failing.

We noted that the public repository is hard coded in yarn.lock (https://github.com/jupyterlab/jupyterlab/blob/v1.2.3/jupyterlab/staging/yarn.lock)

It seems that in Yarn version 2 this would be possible to override, but not in older Yarn versions (that Jupyterlab is using).

Workaround:

So our temporary solution for now is to change these URL's in the yarn.lock file to our private repostiory.

Tips on automation (we use OpenShift):

  • Command in assemble script: sed -i -e "s###g" /opt/app-root/lib/python3.6/site-packages/jupyterlab/staging/yarn.lock

  • Or changing the yarn.lock and adding it as an configmap in the buildconfig

@vidartf
Copy link
Member

vidartf commented Mar 12, 2020

This should be fixed e.g. with #7109. You will need to config the yarn registry, and jupyterlab should pick that up and use that (note you might also need the npm registry to be configured). When lab picks that up, it will overwrite the registry values in the lockfile.

@fcollonval
Copy link
Member

fcollonval commented May 21, 2020

I want to emphasize here too that setting the proxy or the registry to specific target are a matter of npm and yarn configurations not JupyterLab (it just uses both tools).

Since #7109, JupyterLab does not make any assumptions on the registry. And it will replace the default registry in the shipped yarn.lock file with the one specified as yarn configuration.

@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Jun 24, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants