1

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!

Community
  • 1
  • 1
Nils Ziehn
  • 4,118
  • 6
  • 26
  • 40

3 Answers3

1

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

Nils Ziehn
  • 4,118
  • 6
  • 26
  • 40
0

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

Tarang
  • 75,157
  • 39
  • 215
  • 276
  • Not really applicable for to my question since I never have a bundle folder when I directly deploy to meteor servers. Thx for your time though! – Nils Ziehn Sep 30 '13 at 13:12
  • Oh I see I think I know what you're trying to do. I thought fibers/future 'just works' on meteor deploy hosting without the need of binaries. Have you considered `wrapAsync` which would align to more of the official imlementation when its finalized? See https://www.eventedmind.com/posts/meteor-meteor-wrapasync – Tarang Sep 30 '13 at 14:17
0

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

Micha Roon
  • 3,957
  • 2
  • 30
  • 48
  • Thanks for the answer! Unfortunately with meteor deploy I get an error, which I thought was the same problem as in the other related questions – Nils Ziehn Sep 29 '13 at 08:29
  • in the older posts, they use the older meteor versions. have you changed the path to yourapp/programs/server before running npm install fibers? – Micha Roon Sep 29 '13 at 20:51
  • I am not sure which 'older post' you are referring to, but I added a 2nd Edit to my question regarding something you may have been relating to. – Nils Ziehn Sep 29 '13 at 21:47
  • 1
    I think your error does not lie in the usage of future with meteor. The first syntax you mention ´Future = Npm.require("fibers/future")´ is the same as that what works for me. Have a look at this tutorial for an explanation of Future in Meteor: https://www.eventedmind.com/posts/nodejs-using-futures – Micha Roon Sep 30 '13 at 04:36
  • Thx Dr Gorb for your help. As it turns out, the problem was somewhere else. I included the npm package, which broke the npm that comes with meteor – Nils Ziehn Sep 30 '13 at 13:13