簡體   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