Deploy meteor to official meteor servers fibers

2019-08-04 19:05发布

There are already a few questions around here related to this question.

I want to deploy a meteorjs app to the official meteor servers. My application uses fibers, and since fibers is compiled for my system ( Mac OSX ) it creates an error on the ubuntu servers by meteor.

The other questions/answers are related to deploying the app somewhere else than the official meteor servers or they seem to leave a step out, since they don't work for me.

A few of the related posts are these:

Reinstalling node-fibers for a Meteor app on Modulus.io?

Problems with Meteor deployment related to fibers module

I would like to use:

meteor deploy myapp.meteor.com

EDIT:

My question above was not complete unfortunately, I use Future, which is part of fibers. When I deploy it to meteor and access the server logs, I get these WARNINGs and the applications crashes right after.

WARNING /meteor/dev_bundles/0.3.13/lib/node_modules/fibers/future.js:173

WARNING Error: Cannot find module 'fibers/Future'

In my code I have the line:

Future = Npm.require("fibers/future");

Is this not possible on meteor deploy XXX.meteor.com ?

EDIT 2nd: Instead of using:

Future = Npm.require("fibers/future");

I also tried:

var path = Npm.require('path');
var fs = Npm.require('fs');
var base = path.resolve('.');
var isBundle = fs.existsSync(base + '/bundle');
var modulePath = base + (isBundle ? '/bundle/static' : '/public') + '/node_modules';
Future = Npm.require(modulePath + '/fibers/future');

As suggested in this post:

How can I deploy node modules in a Meteor app on meteor.com?

And installed fibers to:

.meteor/local/build/programs/server/public/node_modules/

But with this I get either this when running meteor without sudo Error: EACCES, permission denied 'XXXX/.meteor/local/build' at Object.fs.renameSync (fs.js:439:18)

Or this error, when running it with sudo: Error: Cannot find module 'XXXX/.meteor/local/build/programs/server/public/node_modules/fibers/future'

Usually I run meteor without sudo ofc!

3条回答
劫难
2楼-- · 2019-08-04 19:17

You need to just uninstall the fibers and reinstall it on your server as mentioned in the docs:

cd bundle/programs/server/node_modules
rm -r fibers
npm install fibers@1.0.1

Where the bundle directory is the untarred version of the bundled app you created via meteor bundle xxx.tar.gz on your ubuntu server

查看更多
甜甜的少女心
3楼-- · 2019-08-04 19:27

from the meteor documentation it is clear that you can deploy to meteor.com with ´meteor deploy´ or to your own server by creating a bundle with ´meteor bundle´.

It is only when you create your bundle that you need to install ´fibers´. If you use ´meteor deploy´ there is no need.

The part where you have to remove and reinstall the fibers package is only required if you want to deploy like this

  • create the bundle on your development machine
  • copy the bundle.tgz file to your server which runs a different OS
  • unpack the bundle.tgz file and run the app

When creating the bundle, you have to install fibers in any case. If you do it all on the server the steps are:

  • meteor bundle --release 0.6.5.1 /my/output.tgz
  • tar -xvzf /my/output.tgz
  • mv bundle your-app-name
  • cd your-app-name/programs/server
  • npm install fibers
  • forever start your-app-name/main.js

these steps assume you use the node package forever

查看更多
Emotional °昔
4楼-- · 2019-08-04 19:28

My problem was that I did include the npm package for loading another framework, which broke the new Npm by meteor.

查看更多
登录 后发表回答