开发者问题收集

安装 firebase @angular/fire 时出错

2018-10-02
3450

我正在开发一个 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 [email protected]: AngularFire has moved, we're now @angular/fire

[email protected] 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 [email protected]
   and [email protected] (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: [email protected] (node_modules\fsevents): npm WARN
   notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
   [email protected]: wanted {"os":"darwin","arch":"any"} (current:
   {"os":"win32","arch":"x64"})

   npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected]
   install: `node-pre-gyp install --fallback-to-build
   --library=static_library` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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
3个回答

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

Morema
2018-10-28

以防万一它对其他人有帮助,按照 这里 的建议,运行以下命令对我有用:

npm install firebase --force
Rbar
2019-08-30

如果您拥有该节点的最新版本,请降级您的节点版本并重试,它将正常工作。

Danu Michael
2019-11-02