Centos系统pnpm升级报错 ERR_PNPM_NO_GLOBAL_BIN_DIR

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

完整报错信息

js 复制代码
[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,执行以下两个命令就可以解决:

shell 复制代码
pnpm setup

# CentOS 系统
source ~/.bashrc

# MacOS 系统
source ~/.zshrc

欢迎访问:天问博客

相关推荐
ltl1 小时前
实时 OS 巡礼:VxWorks、QNX、Zephyr 与 PREEMPT_RT
linux
我是谁??1 小时前
Ubuntu22.04更换清华源
linux·运维·服务器
Shell运维手记2 小时前
Linux 常用基础命令学习笔记
linux·运维·笔记·学习·算法·github
朴马丁2 小时前
国际与国产PLM在精细化工赛道的布局:2026年主要厂商技术特色
大数据·运维·人工智能·流程行业plm·化工新材料
Elastic 中国社区官方博客3 小时前
Elasticsearch:使用 AI Agent 来创建 workflow
大数据·运维·人工智能·elasticsearch·搜索引擎·自动化·全文检索
测试运维日常笔记4 小时前
Linux系统安装配置TigerVNC服务器完整指南
linux·运维·服务器
喜欢的名字被抢了4 小时前
程序出问题怎么查,以及如何让它不掉线
java·运维·数据库
雾时之林4 小时前
Linux----cron定时服务
linux·运维·服务器
壹玖玖肆5 小时前
医院后勤智能运维系统实用性评测
运维
wengqidaifeng6 小时前
1.从“会敲命令”到理解 Linux:15 个基础指令、文件树与命令执行的本质
linux·运维·服务器·ubuntu