npm相当于`pip install -r requirements.txt` [英] npm equivalent of `pip install -r requirements.txt`
问题描述
npm等同于什么:
pip freeze > requirements.txt
pip install -r requirements.txt
推荐答案
Normally dependencies in a node project are installed via package.json: https://docs.npmjs.com/files/package.json
使用npm install --save my-dependency
安装每个依赖项,它将被添加到package.json文件中.因此,项目中的下一个人员可以使用npm install
命令将所有依赖项安装在package.json的同一文件夹中.
You install each dependency with npm install --save my-dependency
and it will be added to the package.json file. So the next person on the project can install all the dependencies with npm install
command on the same folder of package.json.
但是对于我而言,我想通过文本文件(类似于pip install -r requirements.txt
)安装npm的全局要求.
But in my case i wanted to install global requirements of npm via a text file (similar to pip install -r requirements.txt
).
您可以执行以下操作:
cat requirements.txt | xargs npm install -g
这篇关于npm相当于`pip install -r requirements.txt`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!