解决报错 pnpm add -g pnpm Nothing to stop

6 min read

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".

这个错误信息表示你当前的pnpm设置与创建模块目录时的设置不一致。你可以按照以下步骤尝试解决此问题:

  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命令了。如果问题仍然存在,请检查你的网络连接并确保你能够访问配置的npm镜像源。