【问题标题】:Why do I have this terminal issue when I try to install Sass?为什么我在尝试安装 Sass 时会出现这个终端问题?
【发布时间】:2021-02-02 03:56:43
【问题描述】:

我在安装 Sass 时遇到了困难。 无论如何,我正在使用终端,当我使用npm install -g sass 时,我在日志文件中收到错误消息。这是我收到的答案:

npm WARN checkPermissions Missing write access to /Users/dagilo/desktop/npm-global/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /Users/dagilo/desktop/npm-global/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/Users/dagilo/desktop/npm-global/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, access '/Users/dagilo/desktop/npm-global/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/Users/dagilo/desktop/npm-global/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/admin/.npm/_logs/2021-02-01T14_18_27_655Z-debug.log
iMac-de-admin-3:Dagilo admin$ npm install -g sass
npm WARN checkPermissions Missing write access to /Users/dagilo/desktop/npm-global/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /Users/dagilo/desktop/npm-global/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/Users/dagilo/desktop/npm-global/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, access '/Users/dagilo/desktop/npm-global/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/Users/dagilo/desktop/npm-global/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/admin/.npm/_logs/2021-02-01T14_19_25_392Z-debug.log

知道如何解决这个问题吗?

【问题讨论】:

    标签: node.js npm sass


    【解决方案1】:

    这是 MAC OS 中的常见权限问题,因此日志表明您可能需要使用命令 sudo npm install -g sass 来获得此安装所需的权限。 你上面的日志说:

    如果您认为这可能是权限问题,请仔细检查文件及其包含目录的权限,或尝试以 root/管理员身份再次运行该命令。

    如果您共享计算机或其公司拥有的计算机,您可能需要管理员帐户或管理员帮助才能这样做。

    另外这里是一个相对的答案和解决方案:NPM modules won't install globally without sudo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-11
      • 2019-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-27
      • 2021-04-10
      相关资源
      最近更新 更多