新机开荒

旧笔记本换新,记录新电脑配置与开发环境搭建过程

周一 7月 06 2026 Development
676 字 · 4 分钟

终于考完试了,新电脑也到了,趁热记录一下迁移过程。

硬件配置

旧电脑新电脑
CPUIntel Core i7-8550U @ 1.80GHzAMD Ryzen 9 9955HX 16-Core
内存8GB DDR416GB DDR5
磁盘1.2TB 机械硬盘1TB 固态硬盘
显卡NVIDIA GeForce 930MX 2GBNVIDIA GeForce RTX 5070 Laptop 8GB

开发环境

VS Code

下载安装后配置中文语言包即可。

Git

官网下载,下了挺久的,如果想快点可以直接下载我下好的安装包:蓝奏云链接(密码:33sv)

之后在命令提示符中输入 git -v 确认是否返回版本号。

然后配置用户名和邮箱(替换为你的信息):

BASH
git config --global user.name "xxx"
git config --global user.email "xxx@xxx.com"

Node.js 和 npm

也是去官网下载,之后在命令提示符中输入 node -vnpm -v 确认是否下载成功。

pnpm

输入:

BASH
npm install --global pnpm

下载 pnpm,然后配置国内镜像源:

BASH
pnpm config set registry https://registry.npmmirror.com

PowerShell 报错

下载好后,我在 VS Code 的自带 PowerShell 终端中测试,发现报错:

POWERSHELL
PS C:\project> node -v
v24.18.0
PS C:\project> npm -v
npm : 无法加载文件 C:\Program Files\nodejs\npm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.c
om/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ npm -v
+ ~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\project> pnpm -v     
pnpm : 无法加载文件 C:\Users\fan_z\AppData\Roaming\npm\pnpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/g
o.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ pnpm -v
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

原因是 Windows PowerShell 的执行策略(Execution Policy)限制阻止了 .ps1(PowerShell 脚本)文件的运行。npmpnpm 命令实际上是通过相应的 .ps1 脚本启动的,因此被系统拦截。

解决办法,以管理员身份运行 PowerShell,输入以下命令:

POWERSHELL
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

然后选 Y

重启终端,就可以使用了。

然后克隆项目、安装依赖、启动开发服务器:

BASH
git clone git@github.com:xxx/xxx.git
cd xxx
pnpm install
pnpm dev

SSH 配置

生成 SSH Key

输入以下命令(将邮箱替换为你的 GitHub 邮箱):

BASH
ssh-keygen -t rsa -C "xxx@xxx.com"

然后一直按 Enter 键。

获取公钥内容

进入 SSH 目录并查看公钥:

BASH
cd ~/.ssh
cat id_rsa.pub

复制输出的内容。

在 GitHub 中添加公钥

  1. 点右上角头像;

  2. 点击 settings

  3. 点击 SSH and GPG keys

  4. 点击 New SSH key

  5. Title 随便取个名字,在 Key 粘贴刚刚复制的公钥。

  6. 点击 Add SSH key

在项目中改点东西,然后推送到 GitHub:

BASH
git add .
git commit -m "xxx"
git push

如果还没设置远程仓库:

BASH
git remote add origin git@github.com:xxx/xxx.git
git push -u origin main

Thanks for reading!

新机开荒

周一 7月 06 2026 Development
676 字 · 4 分钟

评论

正在加载评论...