【问题标题】:Npm EACCESS error when installing Firebase安装 Firebase 时出现 Npm EACCESS 错误
【发布时间】:2021-03-15 20:14:15
【问题描述】:

我曾经能够使用 firebase 运行和部署我的代码。然后我升级到新的 m1 MacBook pro。我 git 克隆了我的代码并做了一些小改动。我尝试使用

firebase deploy

但我收到了错误消息

zsh: command not found: firebase

然后我尝试了

npm install -g firebase-tools
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated debug@4.1.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/firebase-tools/lib/bin/firebase.js
npm ERR! dest /usr/local/bin/firebase
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/firebase-tools/lib/bin/firebase.js' -> '/usr/local/bin/firebase'
npm ERR!  [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/firebase-tools/lib/bin/firebase.js' -> '/usr/local/bin/firebase'] {
npm ERR!   cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/firebase-tools/lib/bin/firebase.js' -> '/usr/local/bin/firebase'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'symlink',
npm ERR!     path: '../lib/node_modules/firebase-tools/lib/bin/firebase.js',
npm ERR!     dest: '/usr/local/bin/firebase'
npm ERR!   },
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/firebase-tools/lib/bin/firebase.js',
npm ERR!   dest: '/usr/local/bin/firebase'
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/brennanadams/.npm/_logs/2020-12-03T18_52_42_463Z-debug.log

我在互联网上查找了这个,但我还没有找到解决方案,感谢任何帮助。我不确定这是因为我的 m1 芯片不兼容,还是因为我升级时重置了一堆设置。谢谢你的帮助。

【问题讨论】:

    标签: node.js firebase npm firebase-cli


    【解决方案1】:

    要在 Mac 上全局安装 npm 包,请尝试使用 sudo 命令运行。您需要输入密码。

    sudo npm install -g firebase-tools

    【讨论】:

      【解决方案2】:

      编辑:这个问题的原始标题询问了request 弃用,这就是为什么我在了解真正的问题和需要解决的问题之前花一段解释这不是真正的问题完成。

      关于request:你不需要做任何事情。 request 将作为 firebase 的依赖项继续正常工作。希望他们会在某个时候用其他东西代替它,但没有问题需要解决。 request 模块的弃用是作为一种主动措施来推动人们采用更积极维护和更现代的解决方案。这并不是因为 request 存在根本性的问题,需要人们现在现在就转移到其他地方或类似的地方。

      相反,您的问题是EACCESS 问题。为此,您需要查看the npm documentation on that problem。结果是您可能想要reinstall Node.js with a version manager,例如nvm。如果你不能或不想这样做,你可以configure npm to install global packages in a directory that you have write permission to

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-07-06
        • 2014-10-17
        • 2018-10-06
        • 2021-11-03
        • 2015-04-27
        • 1970-01-01
        • 1970-01-01
        • 2021-05-26
        相关资源
        最近更新 更多