如何部署节点应用程序依赖项?如何确保使用 npm 安装某些版本的软件包? [英] How to deploy node app dependencies? How is possible to ensure to install certain versions of a package with npm?

查看:62
本文介绍了如何部署节点应用程序依赖项?如何确保使用 npm 安装某些版本的软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为节点应用部署依赖项的最佳方式是什么.如何确保使用 npm 安装某些版本的软件包.python的pip有没有像requirements.txt这样的recipe文件?

What's the best way to deploy the dependencies for a node app. How is possible to ensure to install certain versions of a package with npm. Are there like recipe files as the requirements.txt with python's pip?

推荐答案

package.json 指定模块的依赖项.

https://docs.npmjs.com/files/package.json#dependencies

{ "dependencies" :
  { "foo" : "1.0.0 - 2.9999.9999"
  , "bar" : ">=1.0.2 <2.1.2"
  , "baz" : ">1.0.2 <=2.3.4"
  , "boo" : "2.0.1"
  , "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0"
  , "asd" : "http://asdf.com/asdf.tar.gz"
  , "til" : "~1.2"
  , "elf" : "~1.2.3"
  , "two" : "2.x"
  , "thr" : "3.3.x"
  , "lat" : "latest"
  , "dyl" : "file:../dyl"
  }
}

这篇关于如何部署节点应用程序依赖项?如何确保使用 npm 安装某些版本的软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆