iT邦幫忙

0

json-server 環境安裝

  • 分享至 

  • xImage

第一次發文 想請問在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 ~ %

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
海綿寶寶
iT邦大神 1 級 ‧ 2023-10-28 09:34:31
最佳解答

由訊息看到兩個問題
1.rename 檔案失敗(Permission denied)
字面上是權限不足,但我看你已經 sudo 了,我不確定原因為何
2.chow command not found
這個簡單, 指令是 chown 才對(少打了一個 n)

noellia iT邦新手 5 級 ‧ 2023-10-28 13:45:25 檢舉

謝謝大神!!!

sam0407 iT邦大師 1 級 ‧ 2023-10-31 11:32:23 檢舉

我看到的是:
原PO是先用sudo作了一次,出現"run npm fund for details"訊息後,又再下了這行指令:
npm install -g json-server
所以才會有一堆rename的錯誤

0
janlin002
iT邦好手 1 級 ‧ 2023-10-28 11:12:11
sudo chown -R liaobili /usr/local/lib/node_modules/
noellia iT邦新手 5 級 ‧ 2023-10-28 13:45:38 檢舉

謝謝

我要發表回答

立即登入回答