Centos系统pnpm升级报错 ERR_PNPM_NO_GLOBAL_BIN_DIR


字数:248 阅读时长:1分钟 阅读:85

CentOS 系统中使用 pnpm i -g pnpm 报错:ERR_PNPM_NO_GLOBAL_BIN_DIR Unable to find the global bin directory,折腾半天终于解决了。

CentOS && pnpm

完整报错信息

1
2
3
4
5
[root@VM-8 test]# pnpm i -g pnpm
Nothing to stop. No server is running for the store at /root/.local/share/pnpm/store/v3
ERR_PNPM_NO_GLOBAL_BIN_DIR Unable to find the global bin directory

Run "pnpm setup" to create it automatically, or set the global-bin-dir setting, or the PNPM_HOME env variable. The global bin directory should be in the PATH.

按照给出的提示运行 pnpm setup,再次执行 pnpm i -g pnpm 发现还是出现以上报错。
最后才明白执行 pnpm setup 其实是在环境变量中添加了一些 pnpm 的配置,虽然去查看环境变量已存在,但是并没有生效。
因为缺少了一个重要步骤,那就是 source ~/.bashrc,这样才能使环境变量生效。

总结

出现这种报错:ERR_PNPM_NO_GLOBAL_BIN_DIR Unable to find the global bin directory,执行以下两个命令就可以解决:

1
2
3
4
5
6
7
pnpm setup

# CentOS 系统
source ~/.bashrc

# MacOS 系统
source ~/.zshrc

欢迎访问:天问博客

本文作者: Tiven
发布时间: 2023-08-01
最后更新: 2023-08-07
本文标题: Centos系统pnpm升级报错 ERR_PNPM_NO_GLOBAL_BIN_DIR
本文链接: https://www.tiven.cn/p/42e4215e/
版权声明: 本作品采用 CC BY-NC-SA 4.0 许可协议进行许可。转载请注明出处!
欢迎留言,提问 ^_^
个人邮箱: tw.email@qq.com
notification icon
博客有更新,将会发送通知给您!