ajax front and rear end interactive principle (2)

2.NPM use

What is 2.1.NPM

NPM stands Node Package Manager, is a NodeJS package management and distribution tools to figure out where the package concept, popular to say, the package is the tool (software) has a certain function, in essence, it is a collection of a lot of these packages file , for example, a package diagram is:

The role of this package is to convert the code into the code ES6 ES5, and this package we will talk about later in the webpack course, in short, the first concept you need to understand is that the package is that some files, in fact, we write It has a certain function of the source file

If you understand the concept of packages, the package manager NPM is easy to understand, since called the package manager, it is used to manage and distribute these packages, the package manager is essentially a tool by some source file composition, along with Node.js installation and installed on your computer, you may think this tool is a small software, this little software and Baidu cloud disk is somewhat similar, you can manage your files (upload, download, delete, etc. ), but this small software and Baidu cloud disk is different, it is through the command line operations, while Baidu cloud disk has a graphical interface

2.2 How to use the NPM

npm by the command line to the management pack, used commands are:

1 Initial Project

npm init

After running this command will generate a package.json in the project folder documents, records some information about the project, if coupled with -y parameter indicates the default for all configuration items

npm inint -y

2 installation package

npm install  包名称 --save-dev

Example: Installing jquery

npm install jquery --save

Which, jquery is very famous library, - save the project represents the installation dependencies, you can understand the package later on also need to use the line for the project, we will add --save use this parameter, if some development time supporting development the tool we need to use --save-dev to save, such as: installation babel-cli

npm install bable-cli  --save-dev

Note: babel is a conversion tool to convert ES6 compiled code into the code ES5

--save --save-dev and their positions are not the same record packet, in package.json file, the recording position thereof as shown below:

Screw classroom video lessons Address: http://edu.nodeing.com

Guess you like

Origin www.cnblogs.com/dadifeihong/p/12030683.html