报错信息
/Applications/DevEco-Studio.app/Contents/tools/node/bin/node /Applications/DevEco-Studio.app/Contents/tools/hvigor/bin/hvigorw.js --sync -p product=default --analyze=normal --parallel --incremental --no-daemon
Installing pnpm@8.13.1...
npm ERR! code EEXIST
npm ERR! syscall mkdir
npm ERR! path /Users/apple/.npm/_cacache/content-v2/sha512/75/8b
npm ERR! errno -13
npm ERR! EACCES: permission denied, mkdir '/Users/apple/.npm/_cacache/content-v2/sha512/75/8b'
npm ERR! File exists: /Users/apple/.npm/_cacache/content-v2/sha512/75/8b
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in: /Users/apple/.npm/_logs/2024-12-25T09_06_10_961Z-debug-0.log
Error: /Applications/DevEco-Studio.app/Contents/tools/node/bin/npm install,pnpm execute failed.See above for details.
Process finished with exit code 255
解决方案:
你可以通过更改 .npm 目录的权限来确保当前用户有足够的权限来访问和写入该目录。
sudo chown -R $(whoami) ~/.npm
image.png