node.js - 为什么我不能在我的 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/管理员身份再次运行该命令。我怎么做?
解决方案
推荐阅读
- emulation - 在 QEMU 中运行 MLO 文件
- android - 如何将 MP3 文件转换为八位字节流以将其作为 POST 请求发送
- javascript - 如何根据传递给方法参数的数字为数组定义新的原型方法以进行计数?
- macos - MAC OS 显示中的半透明“水印”
- c# - FakeItEasy - 预计会找到一次或多次,但没有调用假对象
- javascript - 如果电子邮件未使用我的功能验证,则阻止提交表单
- python - 如何将用户输入从一个文件附加到另一个 Python
- django - 如何使用 ajax 更新按钮和计数而不重定向?
- c# - 将具有 Action/Func 参数的同步方法转换为异步
- swiftui - 实现 TextField 时无法推断通用参数“C0”