解决pnpm 升级之后全局安装出现异常问题

2,411 阅读1分钟
╰>>> pnpm -v                                                
7.12.2
╰>>> pnpm add -g  yalc
ERROR  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                      
Appended new lines to /Users/hank/.zshrc

Next configuration changes were made:
export PNPM_HOME="/Users/hank/Library/pnpm"
export PATH="$PNPM_HOME:$PATH"

To start using pnpm, run:
source /Users/hank/.zshrc 

按照提示,执行了 pnpm setup,如果只执行这个是不能生效的,注意下最后提示你 source .zshrc,完事之后即可生效。

╰>>> pnpm add -g yalc                                        
Packages: +42
++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/hank/Library/pnpm/store/v3
  Virtual store is at:             .pnpm
Progress: resolved 42, reused 36, downloaded 6, added 42, done

/Users/hank/Library/pnpm/global/5:
+ yalc 1.0.0-pre.53