node_npm包管理工具_node热加载

复制代码
// 1.NPM是随同NodeJS一起安装的包管理工具
//   允许用户从NPM服务器下载别人编写的第三方包到本地使用
//   允许用户从NPM服务器下载并安装别人编写的命令行程序到本地使用。
//   允许用户将自己编写的包或命令行程序上传到NPM服务器供别人使用。
//   由于新版的nodejs已经集成了npm,所以之前npm也一并安装好了。同样可以通过输入 "npm -v" 来测试是否成功安装
//   $ npm -v ==> 2.3.0
// 2.使用 npm 命令安装模块
//   $ npm install <Module Name>
//   $ npm install express
//   安装好之后,express 包就放在了工程目录下的 node_modules 目录中,
//   因此在代码中只需要通过 require('express') 的方式就好,无需指定第三方包路径。
//   var express = require('express');
// 3.全局安装与本地安装
//   npm 的包安装分为本地安装(local)、全局安装(global)两种,从敲的命令行来看,差别只是有没有-g而已,
//   npm install express      // 本地安装
//   npm install express -g   // 全局安装
//   npm install express --save //安装到项目依赖
// 4.更新模块
//   $ npm update express
// 5.卸载模块
//   $ npm uninstall express
// 6.创建模块
//   创建模块,package.json 文件是必不可少的。我们可以使用 NPM 生成 package.json 文件,生成的文件包含了基本的结果。
//   $ npm init
//   This utility will walk you through creating a package.json file.
//   It only covers the most common items, and tries to guess sensible defaults.

//   See `npm help json` for definitive documentation on these fields
//   and exactly what they do.

//   Use `npm install <pkg> --save` afterwards to install a package and
//   save it as a dependency in the package.json file.

//   Press ^C at any time to quit.
//   name: (node_modules) yoyo                   # 模块名
//   version: (1.0.0) 
//   description: test                           # 描述
//   entry point: (index.js) 
//   test command: make test
//   git repository: https://github.com/runoob/runoob.git  # Github 地址
//   keywords: 
//   author: 
//   license: (ISC) 
//   About to write to ……/node_modules/package.json:      # 生成地址



// ------------------------------------------------------
// 1.使用淘宝 NPM 镜像
//   大家都知道国内直接使用 npm 的官方镜像是非常慢的,这里推荐使用淘宝 NPM 镜像。
//   淘宝 NPM 镜像是一个完整 npmjs.org 镜像,你可以用此代替官方版本(只读),同步频率目前为 10分钟 一次以保证尽量与官方服务同步。
//   你可以使用淘宝定制的 cnpm (gzip 压缩支持) 命令行工具代替默认的 npm:
//   $ npm install -g cnpm --registry=https://registry.npm.taobao.org


// 2.node 热加载
//   1.npm install nodemon -g
//   2.nodemon index.js
复制代码

 

posted @   前端之旅  阅读(221)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
点击右上角即可分享
微信分享提示