问题
If I bundle a meteor app using
meteor bundle iron.tar.gz
can I run the app locally, (localhost:3000), on a different computer that does not have meteor installed. If so, how would I go about doing it? Thanks for the help!
回答1:
Meteor pieces will be bundled in your meteor bundle, but you're going to need to have Node.js and NPM installed on that other box. I use Forever so that it stays up and running and have two scripts. This one takes the bundle name as an argument and installs the bundle per Meteor's instructions into a directory forever can use:
#!/bin/sh
if [ -d "$1" ]
then
rm -rf $1
fi
mkdir $1
cp ~/$1.tgz ./$1
cd ./$1
tar xvfz $1.tgz
rm -rf bundle/programs/server/node_modules/fibers/
npm install fibers@1.0.1
And then I can run the next script that will take the project name as an input and start it in forever against a MongoDB replica set:
#!/bin/sh
export PORT=3000
export MONGO_URL=mongodb://id:pwd@replica1.yourcompany.com:27017,replica2.yourcompany.com:27017,replica3.yourcompany.com:27017/meteor
forever start $1/bundle/main.js
After you run that script you can launch it off localhost or setup nginx as an HTTP server that can they proxy it and run on your host over port 80/443.
回答2:
This is what I ended up doing. My goal was to be able to run my meteor app on a computer that did not have meteor, but did have mongodb and node.js. This is a simple step by step procedure. I wanted to run it on a network that was not online and chose the default localhost:3000 as my address.
Step 1: Navigate to folder where meteor project is located using terminal (cd location).
Step 2:
In terminal:
$ export ROOT_URL='http://localhost:3000'
Step 3:
In terminal:
$ meteor bundle app.tgz
Now with this app.tgz you can send it to the other computer that does not have meteor installed, but does have node.js and mongodb.
Step 4: In finder: Find the zipped bundled app and unzip it.
Step 5:
Run mongodb in a new terminal:
$ mongod
Step 6:
Navigate to the unzipped bundled app in the terminal and use (You must have Node.js installed):
$ PORT=3000 MONGO_URL=mongodb://localhost:27017/app node main.js
Step 7:
Navigate Browser to http://localhost:3000
and app should now be running.
来源:https://stackoverflow.com/questions/23767792/can-you-run-a-meteor-bundle-example-tar-z-on-a-computer-that-doesnt-have-met