部署流星应用程序时如何解决“Failed at the fibers@2.0.0 install script”错误?

how to solve "Failed at the fibers@2.0.0 install script' error while deploying the meteor app?

我知道如何打包然后部署 meteor 应用程序。但是最近对于一个项目我陷入了一个我无法解决的错误。

Steps I followed for package and deploy of my meteor app:

    1. meteor build package 
    2. cd package
    3. tar -xf inventoryTool.tar.gz
    4. cd bundle/programs/server
    5. npm install
    6. cd ../..
    7. PORT=<port> MONGO_URL=mongodb://127.0.0.1:27017/dbName ROOT_URL=http://<ip> node main.js

这是 运行 npm install(STEP 5) 命令时出现错误的 log。 我的执行过程中有什么遗漏吗?我没有在项目的任何地方使用 fibers 包。有人能解决这个问题吗?提前致谢。

为什么(经常)发生这种情况?

您的本地节点版本是v8.9.4。使用 build 命令时,您将导出应用程序并针对此 exact 节点版本构建代码。您的服务器环境也将需要此 exact 版本。

指南 custom deployment section 的摘录:

Depending on the version of Meteor you are using, you should install the proper version of node using the appropriate installation process for your platform. To find out which version of node you should use, run meteor node -v in the development environment, or check the .node_version.txt file within the bundle generated by meteor build.

即使您没有明确使用 fibers,也需要 运行 服务器上的 Meteor 应用正确。

那怎么办?

为了解决这个问题,你需要

a)确保你本地的node版本与服务器上的版本完全匹配

b) 确保您针对服务器的体系结构进行构建(请参阅 build 命令)

要在您的服务器上安装 a) 非常具体的节点版本,您有两个选择:

选项 I. 使用 n,如 here 所述。但是,这仅在您的服务器环境使用 node 而不是 nodejs 时有效(这取决于您在服务器上安装 nodejs 的方式)。

II. 要从存储库安装特定的 nodejs 版本,您可以执行以下操作:

$ cd /tmp
$ wget https://deb.nodesource.com/node_8.x/pool/main/n/nodejs/nodejs_8.9.4-1nodesource1_amd64.deb
$ apt install nodejs_8.9.4-1nodesource1_amd64.deb

如果您不确定您的服务器上安装了哪一个,请查看 node -vnodejs -v。两者之一将 return 一个版本。如果您的 npm install 仍然失败,请检查错误输出,如果它涉及 nodenodejs 并使用上述选项安装所需的发行版。

要针对您服务器上的体系结构构建 b),您应该在 build 命令中使用 --architecture 标志。