将Meteor应用程序部署到Synology armv7:`node-fibers`存在问题

问题描述 投票:2回答:1

我花了几天时间试图在我的Synology ds213j(Armv7,512MB ram)上运行Meteor的构建应用程序。

我一直遇到以下错误

## There is an issue with `node-fibers` ##
`/volume1/homes/user/app/bundle/programs/server/node_modules/fibers/bin/linux-arm-57/fibers.node` is missing.

Try running this to fix the issue: /volume1/homes/user/.nvm/versions/node/v8.11.2/bin/node /volume1/homes/user/app/bundle/programs/server/node_modules/fibers/build
Error: /volume1/homes/user/app/bundle/programs/server/node_modules/fibers/bin/linux-arm-57/fibers.node: internal error
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/volume1/homes/user/app/bundle/programs/server/node_modules/fibers/fibers.js:13:39)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
/volume1/homes/user/app/bundle/programs/server/node_modules/fibers/fibers.js:22
                throw new Error('Missing binary. See message above.');
                ^

Error: Missing binary. See message above.
    at Object.<anonymous> (/volume1/homes/user/app/bundle/programs/server/node_modules/fibers/fibers.js:22:9)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/volume1/homes/user/app/bundle/programs/server/boot.js:1:75)
    at Module._compile (module.js:652:30)

但是,fiber.node实际上存在!

我之前做过的事:

  • 建立流星应用程序meteor build --server-only --architecture os.linux.x86_32
  • 在/ program / server文件夹中npm install --production
  • npm install fibers

我试图解决它:

  • 转到/ programs / server /并运行npm install fiber(并重新安装)
  • 按照https://www.npmjs.com/package/fibers上的说明从源代码安装
  • 我的meteor应用程序使用Node 8.11.2,但唯一可用于synology的节点版本是8.9.4。删除它并手动安装8.11.2
  • 构建一个默认的流星应用程序来检查我的应用程序是否存在问题。

到目前为止没有任何工作,我不知道接下来该做什么。

我怀疑问题是光纤是为linux-arm-57构建的,我想我需要arm-7I?我可以做些什么来使这项工作?

谢谢!

node.js meteor synology node-fibers fiber
1个回答
1
投票

在下文中,我将介绍将应用程序正确部署到ARMv7设备的方式。通过这样做,我将强调可能经常导致错误的重要步骤。我希望通过重现这些步骤来解决您的问题。

1. Build your production app

  • 确保应用程序启动,运行并且所有测试都在本地传递。
  • 获取当前开发版本的节点。请注意,它会有所不同,具体取决于项目使用的流星版本。注意:meteor guide on custom deployment强调了匹配节点版本的重要性。
$ cd ~/path/to/meteor-project
$ meteor node -v
v8.9.4 # this example uses Meteor 1.6.1 which uses node 8.9.4
  • 使用build命令构建你的生产应用程序(我在这里修改了你的规范)。
$ cd ~/path/to/meteor-project
$ meteor npm install --production
$ meteor build ../build/deployment-test --server-only --architecture os.linux.x86_32

2. Prepare your target device' environment

  • Meteor构建也是Node.js应用程序。您的设备需要一个Node.js的ARMv7版本。最简单的方法是使用install script from nodesource(在新选项卡中打开以查看脚本)。
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs
  • 请注意,official node installation guide还指出,“要从npm编译和安装本机插件,您可能还需要安装构建工具”。你需要这个,因为fibersbcrypt就是这样的原生插件。
$ sudo apt-get install -y build-essential
  • 验证已安装的节点版本
$ node -v
v8.11.4 # but we need v8.9.4
  • 获取与开发版本完全匹配的正确版本节点的最简单方法是使用npm n包。
$ sudo npm install -g n
$ sudo n 8.9.4
$ # ... installs target version
$ node -v
v8.9.4 # if this is still the old version just restart the shell
  • 如果您需要帮助,请阅读此github issue thread
  • 最后在目标设备上安装mongodb> = 2.6(重要!)(此答案未涵盖)。

3. Install your production app on the target device

  • 将构建存档复制/移动/上传到目标设备
  • 提取部署包
$ cd ~/path/to/deploymentapp
$ tar -xvzf ./meteor-project.tar.gz # extracts all content into a folder named 'bundle'
  • 在目标系统上安装npm依赖项
$ cd bundle/programs/server/
$ npm install --production
  • 如果您已经复制了上述所有步骤,那么应该在这里安装npm软件包(特别是本机软件包,例如fibersbcrypt),没有任何错误。现在回到bundle/并启动应用程序:
$ cd ../../
$ MONGO_URL=mongodb://yourmongodbcredentials node main.js

我希望通过复制本指南,您将找到解决问题的方法。


Added for SEO reasons: This guide shows how to deploy a Meteor app on a Raspberry PI with ARMv7 architecture and Raspbian (32 bit) installed. It can also be used as a foundation for other ARMv7 devices, such as OP's Synology.
© www.soinside.com 2019 - 2024. All rights reserved.