【问题标题】:Error while installing firebase @angular/fire安装 firebase @angular/fire 时出错
【发布时间】:2022-03-24 13:59:16
【问题描述】:

我正在开发一个 Angular 聊天应用程序。当我尝试通过“npm install --save firebase @angular/fire”安装firebase时。它给了我一个错误列表。据我了解,npm-pre-grp和npm-grp的版本有问题。我什至都安装了@latest,但问题仍然存在。

C:\Coding_data\Angular\base-chat>npm install angularfire2 firebase
--save npm WARN deprecated angularfire2@5.0.2: AngularFire has moved, we're now @angular/fire

grpc@1.13.1 install C:\Coding_data\Angular\base-chat\node_modules\grpc
node-pre-gyp install --fallback-to-build --library=static_library

 - node-pre-gyp WARN Using request for node-pre-gyp https download
   node-pre-gyp WARN Pre-built binaries not installable for grpc@1.13.1
   and node@8.12.0 (node-v57 ABI, unknown) (falling back to source
   compile with node-gyp) node-pre-gyp WARN Hit error ENOENT: no such
   file or directory, open 'C:\path\to\cert_authority_file_base64.cer'
   gyp ERR! configure error gyp ERR! stack Error: Command failed:
   C:\Users\Mayank\AppData\Local\Programs\Python\Python37-32\python.EXE
   -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack   File "<string>", line 1 gyp ERR! stack     import sys; print
   "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack                    
   ^ gyp ERR! stack SyntaxError: invalid syntax gyp ERR! stack gyp ERR!
   stack     at ChildProcess.exithandler (child_process.js:276:12) gyp
   ERR! stack     at emitTwo (events.js:126:13) gyp ERR! stack     at
   ChildProcess.emit (events.js:214:7) gyp ERR! stack     at maybeClose
   (internal/child_process.js:915:16) gyp ERR! stack     at
   Socket.stream.socket.on (internal/child_process.js:336:11) gyp ERR!
   stack     at emitOne (events.js:116:13) gyp ERR! stack     at
   Socket.emit (events.js:211:7) gyp ERR! stack     at
   Pipe._handle.close [as _onclose] (net.js:561:12) gyp ERR! System
   Windows_NT 10.0.17134 gyp ERR! command "C:\\Program
   Files\\nodejs\\node.exe" "C:\\Program
   Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"
   "configure" "--fallback-to-build" "--library=static_library"
   "--module=C:\\Coding_data\\Angular\\base-chat\\node_modules\\grpc\\src\\node\\extension_binary\\node-v57-win32-x64-unknown\\grpc_node.node"
   "--module_name=grpc_node"
   "--module_path=C:\\Coding_data\\Angular\\base-chat\\node_modules\\grpc\\src\\node\\extension_binary\\node-v57-win32-x64-unknown"
   "--napi_version=3" "--node_abi_napi=napi" gyp ERR! cwd
   C:\Coding_data\Angular\base-chat\node_modules\grpc gyp ERR! node -v
   v8.12.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok node-pre-gyp ERR!
   build error node-pre-gyp ERR! stack Error: Failed to execute
   'C:\Program Files\nodejs\node.exe C:\Program
   Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js
   configure --fallback-to-build --library=static_library
   --module=C:\Coding_data\Angular\base-chat\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown\grpc_node.node
   --module_name=grpc_node --module_path=C:\Coding_data\Angular\base-chat\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown
   --napi_version=3 --node_abi_napi=napi' (1) node-pre-gyp ERR! stack     at ChildProcess.<anonymous>
   (C:\Coding_data\Angular\base-chat\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
   node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
   node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
   node-pre-gyp ERR! stack     at maybeClose
   (internal/child_process.js:915:16) node-pre-gyp ERR! stack     at
   Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
   node-pre-gyp ERR! System Windows_NT 10.0.17134 node-pre-gyp ERR!
   command "C:\\Program Files\\nodejs\\node.exe"
   "C:\\Coding_data\\Angular\\base-chat\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp"
   "install" "--fallback-to-build" "--library=static_library"
   node-pre-gyp ERR! cwd
   C:\Coding_data\Angular\base-chat\node_modules\grpc node-pre-gyp ERR!
   node -v v8.12.0 node-pre-gyp ERR! node-pre-gyp -v v0.10.3
   node-pre-gyp ERR! not ok Failed to execute 'C:\Program
   Files\nodejs\node.exe C:\Program
   Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js
   configure --fallback-to-build --library=static_library
   --module=C:\Coding_data\Angular\base-chat\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown\grpc_node.node
   --module_name=grpc_node --module_path=C:\Coding_data\Angular\base-chat\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown
   --napi_version=3 --node_abi_napi=napi' (1) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents): npm WARN
   notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
   fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current:
   {"os":"win32","arch":"x64"})

   npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! grpc@1.13.1
   install: `node-pre-gyp install --fallback-to-build
   --library=static_library` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the grpc@1.13.1 install script. npm ERR! This is probably
   not a problem with npm. There is likely additional logging output
   above.

   npm ERR! A complete log of this run can be found in: npm ERR!    
   C:\Users\Mayank\AppData\Roaming\npm-cache\_logs\2018-10-02T05_01_54_885Z-debug.log

【问题讨论】:

标签: angular npm firebase-realtime-database angularfire2 angularfire


【解决方案1】:

我遇到了同样的问题,我必须安装节点 LTS (8.12.0) 版本而不是当前 (11.0.0) 版本,这为我解决了问题。

【讨论】:

  • 这在 node-gyp 网站上什么都没做的情况下起作用,谢谢。我使用的是 10.13.0 作为参考。
【解决方案2】:

如果它可以帮助其他人,建议 here,运行以下对我有用:

npm install firebase --force

【讨论】:

    【解决方案3】:

    如果您拥有最新版本的节点,请降级您的节点版本并重试。

    【讨论】:

      【解决方案4】:

      尝试 ng add @angular/fire,它将同时安装 firebase 和相关依赖项

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-05
      • 1970-01-01
      • 2018-07-25
      • 1970-01-01
      • 1970-01-01
      • 2020-05-25
      • 2018-12-16
      • 2022-08-06
      相关资源
      最近更新 更多