Javascript 开发环境

最佳实践 4 分钟阅读 更新于 2024-11-06

1. Overview

Windows Linux/WSL
✓ ✓

2. Windows

2.1 pnpm

安装

1
irm https://get.pnpm.io/ps1 | iex

配置

1
2
pnpm config set registry https://registry.npmmirror.com/
pnpm config set --json tools '{\"node\":{\"channels\":{\"release\":\"https://npmmirror.com/mirrors/node/\"}}}'

2.2 node/npm

1
2
3
pnpm runtime set node lts -g
pnpm add -g npm
npm config set registry https://registry.npmmirror.com

2.3 electron

1
2
3
4
5
# 更新 $PROFILE
Add-Content -Path $PROFILE -Value @'
# electron
$env:ELECTRON_MIRROR = "https://npmmirror.com/mirrors/electron/"
'@

3. Linux/WSL

3.1 pnpm

安装

1
curl -fsSL https://get.pnpm.io | sh -

配置

1
2
pnpm config set registry https://registry.npmmirror.com/
pnpm config set --json tools '{"node":{"channels":{"release":"https://npmmirror.com/mirrors/node/"}}}'

3.2 node/npm

1
2
3
pnpm runtime set node lts -g
pnpm add -g npm
npm config set registry https://registry.npmmirror.com

3.3 electron

$HOME/.bashrc

1
export ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"

$HOME/.config/fish/conf.d/electron.fish

1
set -x ELECTRON_MIRROR "https://npmmirror.com/mirrors/electron/"
标签: javascript

如果这篇文章对您有帮助,欢迎打赏支持