NodeJs备忘
常用资料
多版本 (nvm)
安装
scoop install nvm
查看可用node版本
nvm ls available
安装node
nvm install 19.0.1
nvm install 16.18.1
使用指定版本node
# 可能需要管理员权限运行
nvm use 16.18.1
安装
scoop install nodejs
设置国内镜像
npm config set registry=https://registry.npmmirror.com --global
包
- cross-env, Run scripts that set and use environment variables across platforms
- dotenv, About Loads environment variables from .env for nodejs projects.
- dotenv-cli, A cli to load dotenv files
- typicode/json-server
打包
Linux or Mac
# install dependencies
npm install
# if download electron failed during installing, use this command
# ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/" npm install
# serve with hot reload at localhost:9988
npm start
# after the previous step is completed to 100%, open another tab, build up a desktop client
npm run electron
Windows
# install build tools for the first time, just execute once
npm install -g windows-build-tools
# clone code
git clone https://github.com/qishibo/AnotherRedisDesktopManager.git --depth=1
cd AnotherRedisDesktopManager
# install dependencies, 32-bit or 64-bit all use win32
npm install --platform=win32
# serve with hot reload at localhost:9988
npm start
# after the previous step is completed to 100%, open another tab, build up a desktop client
npm run electron
Build
# prepare before package
npm run pack:prepare
# build package on respective platforms
# on windows build 64bit package
npm run pack:win
# on windows build 32bit package
npm run pack:win32
# on mac
npm run pack:mac
# on linux
npm run pack:linux
错误
unable to verify the first certificate
npm config set strict-ssl false