通过environment.yml安装带有conda的npm软件包
我想知道是否可以通过conda的 environment.yml
文件直接安装npm软件包.我知道可以直接使用 pip
安装 pypi
软件包,如下所示:
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
我尝试添加 npm
作为依赖项,因为它是通过 nodejs
安装的,但是不幸的是,它不起作用.
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
☝️不起作用.
我知道我可以在使用 npm install -g jsdoc
安装conda环境之后安装 jsdoc
,但是我很好奇是否有一种集成安装的方法.
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.
在早期,整合其他专业软件包管理器的想法浮出水面,但我认为 pip
集成的问题经历表明,这样做将是一项艰巨的任务.并不是说安装机制会很困难,而是要防止各种程序包管理器相互破坏对方的程序包.因此,不,这不是一回事,很可能不会再有一段时间了.
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.
或者,如果确实需要在环境中安装NPM软件包(即通过YAML安装),则可以为它编写依赖于 nodejs
的Conda软件包,而只需执行 npm install .
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.