Node.js 常用命令

  1. 查看node版本

node --version

  1. 查看npm 版本,检查npm 是否正确安装。

npm -v

  1. 安装cnpm (国内淘宝镜像源),主要用于某些包或命令程序下载不下来的情况


    npm install cnpm -g --registry=https://registry.npm.taobao.org

  2. 安装express模块

npm install express

  1. 全局安装express模块

npm install -g express

  1. 列出已安装模块

npm list

  1. 显示模块详情

npm show express

  1. 升级当前目录下的项目的所有模块

npm update

  1. 升级当前目录下的项目的指定模块

npm update express

  1. 升级全局安装的express模块

npm update -g express

  1. 删除指定的模块

npm uninstall express

  1. 更新node 版本

首先需要确保是否安装 n 模块,这个是node升级需要

没有安装执行:npm i n -g -f

检测使用: n --version

更新node命令:n stable

  1. node 引入模块使用 require

var http = require("http")

后续更新中...

相关推荐
eRRA OFAG8 小时前
Windows 上彻底卸载 Node.js
windows·node.js
❀͜͡傀儡师11 小时前
Claude Code 官方弃用 npm 安装方式:原因分析与完整迁移指南
前端·npm·node.js·claude code
dgvri12 小时前
Node.js使用教程
node.js·编辑器·vim
2601_9498161612 小时前
Node.js npm 安装过程中 EBUSY 错误的分析与解决方案
前端·npm·node.js
2601_9491942612 小时前
TypeScript 与后端开发Node.js
javascript·typescript·node.js
2601_9498153314 小时前
Node.js HTTP模块详解:创建服务器、响应请求与客户端请求
服务器·http·node.js
2601_9498158414 小时前
Node.js NativeAddon 构建工具:node-gyp 安装与配置完全指南
node.js
不会敲代码11 天前
手写一个「迷你 Cursor」:从零构建 AI 编程助手(LangChain + Tool Calling 实战)
langchain·node.js·cursor
不做超级小白1 天前
把图片压小,但不糊:reduceUrImgs项目关键点拆解
前端·开源·node.js
阿赛工作室1 天前
符合欧盟安全标准的 Node.js + Vue3 全栈架构设计
安全·node.js