$ sudo npm install npm -g
淘宝镜像
$ sudo npm install cnpm -g
安装模块
# 安装nodejs的express框架
$ npm install express
# 若出现错误 npm err! Error: connect ECONNREFUSED 127.0.0.1:8888
$ npm config set proxy null
# 查看所有全局安装的模块
$ npm list -g
# 查看某个模块的版本号
$ npm list express
卸载模块
$ npm uninstall express
更新模块
$ npm update express
搜索模块
$ npm search express
创建模块
# 使用 NPM 生成 package.json 文件
$ npm init
# 在 npm 资源库中注册用户(邮箱)
$ npm adduser
Username: csxiaoyao
Password:
Email: (this IS public) 1724338257@qq.com
发布模块
$ npm publish
清空 npm 本地缓存
$ npm cache clear
撤销发布
$ npm unpublish <package>@<version>
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有