Move npm config setting to the conda buildpack
Since everything is based off the conda buildpack now,
and that is where we get npm from
MODIFY
repo2docker/buildpacks/base.py
repo2docker/buildpacks/base.py
@@ -616,32 +616,8 @@ class BaseImage(BuildPack):
"""Return env directives required for build"""
return [
("APP_BASE", "/srv"),
- ("NPM_DIR", "${APP_BASE}/npm"),
- ("NPM_CONFIG_GLOBALCONFIG", "${NPM_DIR}/npmrc"),
]
- def get_path(self):
- return super().get_path() + ["${NPM_DIR}/bin"]
-
- def get_build_scripts(self):
- scripts = [
- (
- "root",
- r"""
- mkdir -p ${NPM_DIR} && \
- chown -R ${NB_USER}:${NB_USER} ${NPM_DIR}
- """,
- ),
- (
- "${NB_USER}",
- r"""
- npm config --global set prefix ${NPM_DIR}
- """,
- ),
- ]
-
- return super().get_build_scripts() + scripts
-
def get_env(self):
"""Return env directives to be set after build"""
return []

MODIFY
repo2docker/buildpacks/conda/__init__.py
repo2docker/buildpacks/conda/__init__.py
@@ -33,6 +33,9 @@ class CondaBuildPack(BaseImage):
env = super().get_build_env() + [
("CONDA_DIR", "${APP_BASE}/conda"),
("NB_PYTHON_PREFIX", "${CONDA_DIR}/envs/notebook"),
+ # We install npm / node from conda-forge
+ ("NPM_DIR", "${APP_BASE}/npm"),
+ ("NPM_CONFIG_GLOBALCONFIG", "${NPM_DIR}/npmrc"),
]
if self.py2:
env.append(("KERNEL_PYTHON_PREFIX", "${CONDA_DIR}/envs/kernel"))
@@ -55,6 +58,8 @@ class CondaBuildPack(BaseImage):
if self.py2:
path.insert(0, "${KERNEL_PYTHON_PREFIX}/bin")
path.insert(0, "${NB_PYTHON_PREFIX}/bin")
+ # This is at the end of $PATH, for backwards compat reasons
+ path.append("${NPM_DIR}/bin")
return path
def get_build_scripts(self):
@@ -83,7 +88,20 @@ class CondaBuildPack(BaseImage):
bash -c 'time /tmp/install-miniforge.bash' && \
rm /tmp/install-miniforge.bash /tmp/environment.yml
""",
- )
+ ),
+ (
+ "root",
+ r"""
+ mkdir -p ${NPM_DIR} && \
+ chown -R ${NB_USER}:${NB_USER} ${NPM_DIR}
+ """,
+ ),
+ (
+ "${NB_USER}",
+ r"""
+ npm config --global set prefix ${NPM_DIR}
+ """,
+ ),
]
major_pythons = {"2": "2.7", "3": "3.7"}

Move npm config setting to the conda buildpack

Since everything is based off the conda buildpack now,
and that is where we get npm from