Node操作MySQL数据库
- 列表项目
安装mysql模块
mysql模块是托管与npm上的第三方模块,它提供了在Node.js项目中连接和操作MySQL数据库的能力。
想要在项目中使用它,需要先运行如下命令,将mysql安装为项目的依赖包:
安装mysql模块
mysql模块是托管与npm上的第三方模块,它提供了在Node.js项目中连接和操作MySQL数据库的能力。
想要在项目中使用它,需要先运行如下命令,将mysql安装为项目的依赖包:
nrm
nrm(npm registry manager )是npm的镜像源管理工具。
一、nrm操作
1、全局安装nrm
npm install nrm -g --save
2、nrm有自带默认配置,*为当前的配置
nrm ls
npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
3、切换当前源地址
nrm use taobao
4、删除源地址
nrm del taobao
3、添加源地址
nrm add https://.**/
4、测试时间
nrm test npm
二、其他操作
1、直接安装cnpm
npm install cnpm -g --registry=https://registry.npm.taobao.org
2、直接更改源地址
npm set registry https://registry.npm.taobao.org/
3、查看npm源地址
npm config list
4、删除源地址
npm config rm registry
执行 “yarn install” 报如下错误,错误表示node版本不一致:
error css-loader@1.0.1: The engine "node" is incompatible with this module. Expected version ">= 6.9.0 <7.0.0 || >= 8.9.0". Got "8.1.2"
方案1:
卸载旧版Node.js,去官网下载并重新安装指定版本区间的Node.js后重新执行命令成功:
忘记Node.js安装位置的可以执行where node进行查看:
方案2:
忽略错误后重新yarn install
yarn config set ignore-engines true