node js 介绍
是一个基于Chrome V8 引擎的 JavaScript 运行环境 可以运行服务器
安装:
https://node js .org/zh-cn 中文网址
使用推荐版 不要下载最新版本
是否安装成功
在cmd 命令行中 输入
node -v
如果输出对应的版本 代表成功 反之失败
使用
只要node 安装完毕 系统默认同步安装 npm
npm称为包(package) 管理工具
查看版本 npm -v
命令
初始化项目
npm init // 生成一个package.json 全局配置文件
安装依赖包
npm install 包名 安装到生产环境
或者
npm install 包名 --save-dev 安装到开发环境
npm i 包名 --save-dev
例如:
npm i swiper jquery --save-dev
卸载依赖包
npm uninstall 包名 --save-dev
全局安装依赖包
npm i 包名 -g
npm命令
access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, query, rebuild, repo,
restart, root, run-script, search, set, shrinkwrap, star,
stars, start, stop, team, test, token, uninstall, unpublish,
unstar, update, version, view, whoami
cnpm 与 yarn
cnpm
淘宝镜像
安装:
npm install -g cnpm --registry=https://registry.npm.taobao.org