繁体   English   中英

无法使用 npm 安装 Firebase CLI

[英]Can not install Firebase CLI using npm

我首先安装了节点和 npm

Ahmads-MacBook-Pro:~ ahmadbazzi$ npm --version
5.6.0
Ahmads-MacBook-Pro:~ ahmadbazzi$ node --version
v8.9.4

然后我按照此处的步骤https://firebase.google.com/docs/functions/get-started安装 firebase CLI。 我第一次执行

Ahmads-MacBook-Pro:~ ahmadbazzi$ npm install -g firebase-tools

这给了我一大堆警告

npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN checkPermissions Missing write access to /Users/ahmadbazzi/.npm-global/lib/node_modules/firebase-tools
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @google-cloud/functions-emulator@1.0.0-alpha.23 (node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator):
npm WARN 404 SKIPPING OPTIONAL DEPENDENCY: Not Found: @google-cloud/functions-emulator@1.0.0-alpha.23

和一大堆错误

npm ERR! path /Users/ahmadbazzi/.npm-global/lib/node_modules/firebase-tools
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/ahmadbazzi/.npm-global/lib/node_modules/firebase-tools'
npm ERR!  { Error: EACCES: permission denied, access '/Users/ahmadbazzi/.npm-global/lib/node_modules/firebase-tools'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/Users/ahmadbazzi/.npm-global/lib/node_modules/firebase-tools\'',
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/Users/ahmadbazzi/.npm-global/lib/node_modules/firebase-tools' }`
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ahmadbazzi/path to npmrc folder/_logs/2018-01-23T17_29_19_771Z-debug.log

尝试各种事情:

  1. 反复尝试卸载并重新安装。 有时问题可以自行解决。

    npm uninstall -g firebase-tools; npm install -g firebase-tools

  2. 检查错误消息中文件的特定权限。 你有写权限吗? 如果不这样做,您是否可能需要使用sudo来编写它们?

  3. 完全吹走它试图安装的位置,这显然是/Users/ahmadbazzi/.npm-global给你的。

这对我有用:

sudo npm install -g firebase-tools

显然,安装需要超级用户权限,您可以使用sudo请求。

可能有点晚了,但是这对我有用。即使我(反复)在全局安装了该软件包,我的bash也无法识别该命令。 因此,完成所有步骤

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

在那之后,它就像一种魅力!

这对我有用尝试: npm i firebase --save --force

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM