解决报错 pnpm add -g pnpm Nothing to stop. No server is running for the store

5 min read
  1. 删除node_modules目录和pnpm-lock.yaml文件(如果存在):

    bashCopy code
    rm -rf node_modules
    rm pnpm-lock.yaml
    
  2. 更新你的pnpm设置以使用正确的npm镜像源。根据报错信息,你需要更改为之前使用的镜像源(https://registry.npmmirror.com/)。你可以使用以下命令更改设置:

    arduinoCopy code
    pnpm config set registry https://registry.npmmirror.com/
    
  3. 重新运行pnpm install以根据新设置重新创建模块目录:

    Copy code
    pnpm install
    

解决报错 pnpm add -g pnpm Nothing to stop. No server is running for the store at /Users/pan/Library/pnpm/store/v3 ERR_PNPM_REGISTRIES_MISMATCH  This modules directory was created using the following registries configuration: {"default":"https://registry.npmmirror.com/"}. The current configuration is {"default":"http://192.168.2.10:4873/"}. To recreate the modules directory using the new settings, run "pnpm install".