第一次發文 想請問在mac終端機安裝出現以下的訊息
剛開始學習前端 所以不熟悉
想請問要如何解決 謝謝
Last login: Fri Oct 27 23:09:31 on ttys000
liaobili@liaobilideMacBook-Pro ~ % sudo npm install -g json-server
Password:
changed 116 packages in 6s
15 packages are looking for funding
run npm fund
for details
liaobili@liaobilideMacBook-Pro ~ % npm install -g json-server
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/json-server
npm ERR! dest /usr/local/lib/node_modules/.json-server-SmlbN4FS
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/json-server' -> '/usr/local/lib/node_modules/.json-server-SmlbN4FS'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/json-server' -> '/usr/local/lib/node_modules/.json-server-SmlbN4FS'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/json-server',
npm ERR! dest: '/usr/local/lib/node_modules/.json-server-SmlbN4FS'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in: /Users/liaobili/.npm/_logs/2023-10-27T15_17_06_992Z-debug-0.log
liaobili@liaobilideMacBook-Pro ~ % sudo chow -R 501:20 "/Users/liaobili/.nom"
sudo: chow: command not found
liaobili@liaobilideMacBook-Pro ~ %
由訊息看到兩個問題
1.rename 檔案失敗(Permission denied)
字面上是權限不足,但我看你已經 sudo 了,我不確定原因為何
2.chow command not found
這個簡單, 指令是 chown 才對(少打了一個 n)
sudo chown -R liaobili /usr/local/lib/node_modules/