如何部署节点应用程序依赖项?如何确保使用npm安装某个版本的软件包?

opt*_*ixx 3 node.js npm

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

Ray*_*nos 6

A 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"
  }
}
Run Code Online (Sandbox Code Playgroud)

  • 文档链接坏了 (2认同)