firebase 函数无法部署

firebase functions fails to deploy

我在尝试部署 Firebase 功能时遇到问题。如果我尝试执行 firebase -deploy,我最终会遇到以下错误。我正在使用 windows 10 和 git bash 到 运行 这个。我的 firebase 版本:3.19.3 npm -v: 6.2.0

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\vikce\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\vikce\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=C:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64"
gyp ERR! cwd C:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\node_modules\grpc
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.7.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:\Users\vikce\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64\grpc_node.node --module_name=grpc_node --module_path=C:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\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:925: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:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\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:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\node_modules\grpc
node-pre-gyp ERR! node -v v8.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\vikce\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64\grpc_node.node --module_name=grpc_node --module_path=C:\Users\vikce\OneDrive\Documents\moblizeIt\moblizeit-bots-offering\mit-bots\functions\node_modules\firebase-admin\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.6.0 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.6.0 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\vikce\AppData\Roaming\npm-cache\_logs18-07-23T15_07_00_437Z-debug.log

确保您已登录到 firebase

firebase login

然后做

firebase use --add

在文件夹内尝试

firebase deploy --only functions

这不是尝试部署整个文件,而是可以定位函数。