首页 > 解决方案 > 为什么我不能在我的 Mac OS Catalina 上使用 Node 安装任何东西

问题描述

我需要使用 node 安装许多东西,但是自从我将系统更新到 Catalina 后,我就得到了错误,我认为这是由于 Mac 上的新安全措施造成的。

我尝试安装的最后一件事是这个命令:

npm install -g gulp gulp-cli browser-sync

我收到了这个错误

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!   stack: "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/jessiematias/.npm/_logs/2020-03-31T15_45_46_951Z-debug.log

每当我尝试在命令行上安装某些东西时,如何确保不再出现这些错误?意思是尝试以 root/管理员身份再次运行该命令。我怎么做?

标签: node.jsmacoscommand-lineterminalmacos-catalina

解决方案


推荐阅读