缺少节点v57-linux-x64/grpc_node.node [英] node-v57-linux-x64/grpc_node.node missing

查看:151
本文介绍了缺少节点v57-linux-x64/grpc_node.node的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

完全按照以下步骤操作时:

When following exactly these steps:

https://firebase.google.com/docs/admin/setup

然后部署到我的服务器时,出现此错误:

And deploying to my server, I get this error:

2017-10-16 19:19:56 4199bf47fc2d ---> Starting app
2017-10-16 19:19:56 4199bf47fc2d Detected server.js file
2017-10-16 19:19:57 4199bf47fc2d module.js:529
2017-10-16 19:19:57 4199bf47fc2d     throw err;
2017-10-16 19:19:57 4199bf47fc2d     ^
2017-10-16 19:19:57 4199bf47fc2d 
2017-10-16 19:19:57 4199bf47fc2d Error: Cannot find module '/data/app/node_modules/firebase-admin/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'
2017-10-16 19:19:57 4199bf47fc2d     at Function.Module._resolveFilename (module.js:527:15)
2017-10-16 19:19:57 4199bf47fc2d     at Function.Module._load (module.js:476:23)
2017-10-16 19:19:57 4199bf47fc2d     at Module.require (module.js:568:17)
2017-10-16 19:19:57 4199bf47fc2d     at require (internal/module.js:11:18)
2017-10-16 19:19:57 4199bf47fc2d     at Object.<anonymous> (/data/app/node_modules/firebase-admin/node_modules/grpc/src/node/src/grpc_extension.js:30:15)
2017-10-16 19:19:57 4199bf47fc2d     at Module._compile (module.js:624:30)
2017-10-16 19:19:57 4199bf47fc2d     at Object.Module._extensions..js (module.js:635:10)
2017-10-16 19:19:57 4199bf47fc2d     at Module.load (module.js:545:32)
2017-10-16 19:19:57 4199bf47fc2d     at tryModuleLoad (module.js:508:12)
2017-10-16 19:19:57 4199bf47fc2d     at Function.Module._load (module.js:500:3)

它已安装在新文件夹中,最新安装了npm,并重新安装了所有已删除的node_modules映射,npm install --unsafe-perm,npm rebuild等.为什么不安装该模块?

It was installed in a new folder, newest npm and all, removed node_modules map reinstalled, npm install --unsafe-perm, npm rebuild etc. Nothing is working. Why isn't the module being installed?

推荐答案

我遇到了同样的问题.对我们来说,问题是我们在Mac上安装了节点模块,而firebase-admin的安装正在为二进制文件放入特定于平台的文件.

I just ran into the same issue. For us the problem was that we're installing the node modules on a mac and the install of firebase-admin is putting a platform specific file in for the binary.

运行安装并检查此目录后,我看到以下内容:

After running the install and checking this directory I see this:

$ ls node_modules/firebase-admin/node_modules/grpc/src/node/extension_binary/
node-v48-darwin-x64

但是正在运行lamba的环境正在寻找:

But the environment that is running the lamba is looking for:

 node-v48-linux-x64

一个简单的解决方案是在与使用docker运行lambda相同的环境中运行npm install.在我们的案例中,我发现lambci项目已经针对此确切用例预先构建了docker容器.在这里,我添加了一个npm脚本行来处理构建:

An easy solution is to run the npm install in the same environment that the lambda is running in using docker. In our case I found that the lambci project has prebuilt docker containers for this exact use case. Here I've added an npm script line to handle the build:

  "scripts": {
      "package": "rm -rf node_modules && docker run -v $PWD:/var/task -w /var/task lambci/lambda:build-nodejs6.10 npm install"
  },

这篇关于缺少节点v57-linux-x64/grpc_node.node的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆