Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install npm package with conda via environment.yml

I am wondering if it's possible to install npm packages directly through conda's environment.yml file. I know one can install pypi packages with pip directly as follows:

name: docs
channels:
  - conda-forge

dependencies:
  - python>=3.7
  - nodejs=10.*
  - pip
  - pip:
    - Sphinx==1.6.5

I've tried adding npm as a dependency as it's installed via nodejs but that doesn't work, unfortunately.

name: docs
channels:
  - conda-forge

dependencies:
  - python>=3.7
  - nodejs=10.*
  - pip
  - pip:
    - Sphinx==1.6.5
  - npm:
    - jsdoc

☝️ Doesn't work.

I know I can install jsdoc after installing the conda environment using npm install -g jsdoc but I am curious if there's a way to integrate the installation.

like image 657
F Lekschas Avatar asked Jul 17 '19 19:07

F Lekschas


1 Answers

In the early days, the idea of integrating other specialized package managers was floated, but I think the problematic experience with pip integration has indicated that doing so would be a Herculean task. It's not that setting up the installation mechanism would be hard, it's the safeguarding against the various package managers clobbering each other's packages. So, no it's not a thing and likely won't be for a while.

Alternatively, if one really needed to have an NPM package in an env (i.e., installed via the YAML), one could write a Conda package for it that depended on nodejs and simply did an npm install call in the build script.

like image 96
merv Avatar answered Oct 17 '22 09:10

merv