簡體   English   中英

在 MacOS Catalina 上安裝 npm 實時服務器

[英]Installing npm live-server on MacOS Catalina

我正在嘗試安裝 npm 實時服務器,但出現以下錯誤:

stl34>>npm install live-server -g    
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated opn@6.0.0: The package has been renamed to `open`
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules'
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/stl34/.npm/_logs/2020-08-10T22_30_11_210Z-debug.log

問題似乎是/usr/local/lib/node_modules的文件權限需要更改。 我嘗試在恢復模式下重新啟動並在終端中輸入:

csrutil disable

禁用 SIP。 然后我重新啟動並在終端中輸入以下內容:

sudo mount -uw /

chmod 775 usr/local/lib/node_modules

但是系統仍然不允許我修改文件權限。 我可以做些什么來修改它們?

另一位用戶在這里問了同樣的問題: NPM Live-server not installed on zsh but沒有收到答案。

運行“sudo npm install live-server -g”對我有用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM