Node 常用命令

作者: 嗝喯唲 | 来源:发表于2016-05-26 10:00 被阅读1340次
node -v

npm config set prefix "C:\Program Files\nodejs"

npm config set registry "http://r.cnpmjs.org/"

npm config delete http-proxy

npm config delete https-proxy

npm install xxx 安装模块

npm install xxx -g 将模块安装到全局环境中 
参考http://goddyzhao.tumblr.com/post/9835631010/no-direct-command-for-local-installed-command-line-modul

npm ls 查看安装的模块及依赖

npm ls -g 查看全局安装的模块及依赖

npm uninstall xxx  (-g) 卸载模块

npm cache clean 清理缓存

npm 包的安装分为全局安装和本地安装:

1)本地安装:npm install xxx 当前目录安装

2)全局安装:npm install xxx -g  安装到全局

npm ls 查看所有本地安装的模块

npm ls -g 查看全局安装的模块

npm uninstall xxxx 卸载包npm update xxxx 更新包

npm search xxx 搜索模块

package.json 文件是必须的,可以使用npm生成基本的结果

npm init  最后输入yes

通过pm config set prefix "D:\nodejs\node_global"  设置全局目录

npm config get prefix 来获取当前设置的目录

npm config set prefix "D:\nodejs\node_global"

npm config set cache "D:\nodejs\node_cache"

相关文章

网友评论

    本文标题:Node 常用命令

    本文链接:https://www.haomeiwen.com/subject/dhtxdttx.html