简体   繁体   English

通过 environment.yml 使用 conda 安装 npm 包

[英]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.我想知道是否可以通过 conda 的environment.yml文件直接安装 npm 包。 I know one can install pypi packages with pip directly as follows:我知道可以直接使用pip安装pypi包,如下所示:

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.我尝试将npm添加为依赖项,因为它是通过nodejs安装的,但不幸的是,这不起作用。

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.我知道我可以安装jsdoc安装使用畅达环境后, npm install -g jsdoc但我很好奇,如果有集成安装的方式。

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.早期,集成其他专业包管理器的想法浮出水面,但我认为pip集成的问题经验表明,这样做将是一项艰巨的任务。 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 (ie, 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.或者,如果确实需要在 env 中安装 NPM 包(即通过 YAML 安装),则可以为它编写一个依赖于nodejs的 Conda 包,并在构建脚本中简单地进行npm install调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM