node模块系统常用命令

Posted JS全栈...

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了node模块系统常用命令相关的知识,希望对你有一定的参考价值。

node模块系统常用命令

命令

示例

备注

安装模块

npm install commander

最新版本

npm install [email protected]

指定版本

npm install [email protected]

支持通配符,代表1.0版本下的最新补丁

npm install [email protected]""

支持版本范围描述,代表最新版本

npm install [email protected]"*"

支持版本范围描述,代表最新版本

npm install [email protected]"=1.1.0"

指定版本

npm install [email protected]"~1.0.0"

大于或等于指定版本,小于下一个主版本(2.0.0

npm install [email protected]">1.0.0"

 

npm install [email protected]"<1.1.0"

 

npm install [email protected]">=1.0.0 <1.1.0"

 

npm install [email protected]"1.0.0 - 1.1.0 "

 

npm install [email protected]"<=1.1.0 ||>=1.1.0"

 

npm intall https://github.com/.../master

直接从git 地址安装

npm install commander -g

安装到全局目录

查看模块

npm ls -g

查看全局安装的所有模块及其依赖

npm ls

查看当前目录下的所有模块及其依赖(需切换到当前目录)

npm outdated (-g)

查看当前目录下过时的模块( 全局)

更新模块

npm update commander (-g)

 

缷载模块

npm rm commander

 

关联模块

cd link-module

npm link

 

cd -commander-module

npm link link-module

分两步:

1.       设定某个模块可关联(全局可访问)

2.       在当前模块下,关联一个可关联的模块

 

以上是关于node模块系统常用命令的主要内容,如果未能解决你的问题,请参考以下文章

npm常用命令

nodejs npm常用命令

nodejs npm常用命令

npm 常用命令

node.js 使用----相关常用命令总结

npm常用命令整理