【问题标题】:npm problems with installing gulp安装 gulp 的 npm 问题
【发布时间】:2020-01-27 12:07:52
【问题描述】:

当我想使用 npm (gulp) 安装某些东西时,我的终端出现问题。 如果您对此有所了解,请提供帮助。

roman@MacBook-Pro-Roman advanced % npm
Error: EROFS: read-only file system, mkdir '/Roman'
TypeError: Cannot read property 'loaded' of undefined
    at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97:27)
    at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:78:20
    at cb (/usr/local/lib/node_modules/npm/lib/npm.js:225:22)
    at /usr/local/lib/node_modules/npm/lib/npm.js:263:24
    at /usr/local/lib/node_modules/npm/lib/config/core.js:81:7
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/npm/lib/config/core.js:80:13
    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:171:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97
  var doExit = npm.config.loaded ? npm.config.get('_exit') : true
                          ^

TypeError: Cannot read property 'loaded' of undefined
    at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97:27)
    at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
    at process.emit (events.js:321:20)
    at process._fatalException (internal/process/execution.js:165:25)

【问题讨论】:

  • 试试这个 -> npm cache clean
  • 另外,您可能需要在此位置 '/Roman' 授予对 npm 的访问权限
  • @sudhee,当我输入 npm cache clean 时,我有同样的错误
  • @sudhee,如果你有一些链接如何给予权限请评论

标签: node.js npm gulp npm-install


【解决方案1】:

在我看来,您要么有一个设置为只读的文件系统。可能是由于某些软件/硬件问题或未正确设置 npm 写入存储设备的权限。

【讨论】:

    【解决方案2】:

    我已经找到答案了:

    sudo npm 配置设置前缀 ~/npm

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-14
      • 2019-05-31
      • 1970-01-01
      • 1970-01-01
      • 2018-08-27
      • 1970-01-01
      相关资源
      最近更新 更多