我一直在看教程和搜索,我在這里看到了幾個類似的問題。但是沒有相同的錯誤。因此,如果之前已經回答過這個問題,我深表歉意。
我正在上自定進度的編碼課程。我應該安裝sass。我終于找到了一個看似簡單的教程。但是當我輸入命令時,我的終端中出現了錯誤代碼。我對這一切都很陌生,所以我不知道這意味著什么。
一些背景:我下載了自制軟體,但也不明白(所以我卸載了它)。然后我按照這個教程下載了 node.js/npm。一切都很順利,直到我嘗試了這個install -g sass命令。然后我開始收到所有這些訊息并進入兔子洞。Npmjs.com有一些關于這個問題的資訊,但我無法弄清楚。它提到重新安裝 npm 或使用“nvm”。但是當我嘗試該命令時npm install -g npm,它回傳了非常相似的錯誤。
carlosprieto@Carloss-Mac-mini ~ % npm install -g sass
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/sass
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/sass'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/sass'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/sass'
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:
npm ERR! /Users/carlosprieto/.npm/_logs/2022-06-17T16_02_28_018Z-debug-0.log
uj5u.com熱心網友回復:
您需要管理員權限,使用sudo應該可以幫助您
sudo npm i -g sass
這意味著您具有超級用戶訪問權限,并且需要全域安裝軟體包。
在這里閱讀更多:https ://www.tutorialspoint.com/unix_commands/sudo.htm
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/494067.html
