npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /Users/xxx/.npm-global/lib/node_modules/pnpm
npm ERR! dest /Users/xxx/.npm-global/lib/node_modules/.pnpm-hZdqT73T
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 501:20 “/Users/xxx/.npm”
npm ERR! A complete log of this run can be found in: /Users/xxx/.npm/_logs/2024-07-30T06_20_12_778Z-debug-0.log
xxx@xxxdeMacBook-Pro ~ %
修复方法如下
xxx@xxxdeMacBook-Pro ~ % npm config set prefix ‘~/.npm-global’
xxx@xxxdeMacBook-Pro ~ % export PATH=~/.npm-global/bin:$PATH
xxx@xxxdeMacBook-Pro ~ % npm install -g pnpm