为node.js安装firebase-admin时出现grpc installion错误

时间:2018-01-31 19:06:08

标签: node.js firebase-admin

我最近将我的firebase-admin依赖关系从5.5.1更新到5.8.2并尝试安装新的依赖项,但是,它失败了,我无法再部署目录中的云功能。

package.json文件是:

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase serve --only functions",
    "shell": "firebase experimental:functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "firebase-admin": "~5.8.2",
    "firebase-functions": "^0.8.1"
  },
  "private": true
}

错误日志如下:

> grpc@1.8.4 install C:\Users\kusha\FirebaseWaitlistFunctions\functions\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.8.4/node-v59-win32-x64-unknown.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.8.4 and node@9.4.0 (node-v59 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python36\", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\kusha\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\kusha\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Users\kusha\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:166:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\kusha\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=C:\\Users\\kusha\\FirebaseWaitlistFunctions\\functions\\node_modules\\grpc\\src\\node\\extension_binary\\node-v59-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\\Users\\kusha\\FirebaseWaitlistFunctions\\functions\\node_modules\\grpc\\src\\node\\extension_binary\\node-v59-win32-x64-unknown"
gyp ERR! cwd C:\Users\kusha\FirebaseWaitlistFunctions\functions\node_modules\grpc
gyp ERR! node -v v9.4.0
gyp ERR! node-gyp -v v3.6.2
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\kusha\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\kusha\FirebaseWaitlistFunctions\functions\node_modules\grpc\src\node\extension_binary\node-v59-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\kusha\FirebaseWaitlistFunctions\functions\node_modules\grpc\src\node\extension_binary\node-v59-win32-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\kusha\FirebaseWaitlistFunctions\functions\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:160:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:943:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Windows_NT 10.0.15063
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\kusha\\FirebaseWaitlistFunctions\\functions\\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\kusha\FirebaseWaitlistFunctions\functions\node_modules\grpc
node-pre-gyp ERR! node -v v9.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\kusha\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\kusha\FirebaseWaitlistFunctions\functions\node_modules\grpc\src\node\extension_binary\node-v59-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\kusha\FirebaseWaitlistFunctions\functions\node_modules\grpc\src\node\extension_binary\node-v59-win32-x64-unknown' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.8.4 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.8.4 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\kusha\AppData\Roaming\npm-cache\_logs\2018-01-31T18_47_14_943Z-debug.log

我的Windows版本是10.0.15063

显示的python错误似乎很愚蠢,因为我安装了python并且设置了PYTHON变量并且在路径变量中也有它。从cmd中的任何地方运行python命令都会让我进入python控制台部分。

我尝试将firebase工具更新到最新版本3.17.4,但在那里得到了相同的警告,但它说它的依赖是可选的。

我将我的Node.js更新为9.4.0官方网站上发现的最新版本。 使用npm install -g npm

将npm更新为5.6.0

我很遗憾不是Node.js开发人员,这是我第一次冒险,因为必须使用firebase-functions。请指出正确的方向,因为我不知道如何解决这个问题。我的功能代码没有问题,因为它在我尝试更新依赖项之前工作正常。

1 个答案:

答案 0 :(得分:0)

对于那些看到这个问题的人来说,在撰写本文时,我发现让这个错误消失的唯一解决方案是禁用防病毒服务一段时间。

我看到这种情况发生在我的卡巴斯基反病毒运行时。 github库中的多个人已经在多个地方提出了这个问题。 他们中的大多数人都发现禁用防病毒软件会使问题消失。

解决方案适用于函数1.0.1