简体   繁体   English

NodeJS和文件package.json

[英]NodeJS and file package.json

I'm just approaching node-js, I wanted to know what the difference is between the files 我正在接近node-js,我想知道文件之间的区别是什么

package.json
package-lock.json

Finally I wanted to know if it exists in addition to the command nmp install to install the various dependencies a command to make the build / dist to be able to deploy on other machines 最后,我想知道它是否存在,除了安装各种依赖项的命令nmp install之外,还有一个命令可以使build / dist能够部署在其他机器上

a command similar to maven install that creates the .jar file of my Java application. 一个类似于maven install的命令,该命令创建Java应用程序的.jar文件。

Thanks 谢谢

The basic part of Node Package Management (NPM) is Command Line Interface (CLI) that work in all situation. 节点程序包管理(NPM)的基本部分是命令行界面(CLI),它可以在所有情况下正常工作。

A) 一种)

A Node.js base project initialize when Node.js基础项目在以下时间初始化

 $ npm init

In this moment package.json generated automatically with minimized key/value data. 此时,package.json会自动使用最小化的键/值数据生成。 some feature like name, version, keywords, description 一些功能,例如名称,版本,关键字,描述

B) B)

If you need any dependency for inject in project, with command line 如果您需要任何依赖项来注入项目,请使用命令行

$ npm install --save express

add it to local node_module folder. 将其添加到本地node_module文件夹。

Notice: in 注意:

--save
flag dependency install locally. 标志依赖项在本地安装。

C) C)

All dependency that store in your node_modules indexed in package-lock.json file that shows available package in node_modules . 存储在node_modules中的所有依赖项都package-lock.json文件中建立了索引, 文件显示了node_modules中的可用软件包。

In fact package-lock.json containe more detaile like: 实际上package-lock.json包含更多详细信息,例如:

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

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