- Command Line
- meteor help
- meteor run
- meteor debug
- meteor create name
- meteor login / logout
- meteor deploy site
- meteor update
- meteor add package
- meteor remove package
- meteor list
- meteor add-platform platform
- meteor remove-platform platform
- meteor list-platforms
- meteor mongo
- meteor reset
- meteor build
- meteor lint
- meteor search
- meteor show
- meteor publish
- meteor publish-for-arch
- meteor publish-release
- meteor test-packages
- meteor admin
- meteor shell
- meteor npm
- meteor node
Command Line
Documentation of the various command line options of the Meteor tool.
The following are some of the more commonly used commands in the meteor
command-line tool. This is just an overview and does not mention every commandor every option to every command; for more details, use the meteor help
command.
meteor help
Get help on meteor command line usage. Running meteor help
byitself will list the common meteorcommands. Running meteor help command
will printdetailed help about the command.
meteor run
Run a meteor development server in the current project. Searchesupward from the current directory for the root directory of a Meteorproject. Whenever you change any of the application’s source files, thechanges are automatically detected and applied to the runningapplication.
You can use the application by pointing your web browser atlocalhost:3000. No Internet connection isrequired.
This is the default command. Simply running meteor
is thesame as meteor run
.
To pass additional options to Node.js use the NODE_OPTIONS
environment variable.For example: NODE_OPTIONS='—debug'
or NODE_OPTIONS='—debug-brk'
To specify a port to listen on (instead of the default 3000), use —port [PORT]
.(The development server also uses port N+1
for the default MongoDB instance)
For example: meteor run —port 4000
will run the development server on http://localhost:4000
and the development MongoDB instance on mongodb://localhost:4001
.
Run meteor help run
to see the full list of options.
meteor debug
Run the project, but suspend the server process for debugging.
NOTE: The
meteor debug
command has been superseded by the more flexible—inspect
and—inspect-brk
command-line flags, which work for anyrun
,test
, ortest-packages
command.The syntax of these flags is the same as the equivalent Node.jsflags,with two notable differences:
The flags affect the server process spawned by the build process,rather than affecting the build process itself.
The
—inspect-brk
flag causes the server process to pause just afterserver code has loaded but before it begins to execute, giving thedeveloper a chance to set breakpoints in server code.
The server process will be suspended just before the first statement ofserver code that would normally execute. In order to continue execution ofserver code, use either the web-based Node Inspector or the command-linedebugger (further instructions will be printed in the console).
Breakpoints can be set using the debugger
keyword, or through the web UI of Node Inspector (“Sources” tab).
The server process debugger will listen for incoming connections fromdebugging clients, such as node-inspector, on port 5858 by default. Tospecify a different port use the —debug-port <port>
option.
The same debugging functionality can be achieved by adding the —debug-port <port>
option to other meteor
tool commands, such as meteor run
and meteor test-packages
.
Note: Due to a bug in
node-inspector
, pushing “Enter” after a command on the Node Inspector Console will not successfully send the command to the server. If you require this functionality, please consider using Safari ormeteor shell
in order to interact with the server console until thenode-inspector
project fixes the bug. Alternatively, there is a hot-patch available in this comment on #7991.
meteor create name
Create a new Meteor project. By default, makes a subdirectory named _name_and copies in the template app. You can pass an absolute or relativepath.
Flags
—bare
Creates a basic, empty project.
—full
Creates a more complete, imports-based project whichclosely matches the file structure recommended by theMeteor Guide
—minimal
Creates a project with as few Meteor Packages as possible.
—package
Creates a new package. If used in anexisting app, this command will create a package in the packagesdirectory.
Packages
Default | —bare | —full | —minimal | |
---|---|---|---|---|
autopublish | X | |||
blaze-html-templates | X | X | ||
ecmascript | X | X | X | X |
es5-shim | X | X | X | X |
insecure | X | |||
johanbrook:publication-collector | X | |||
kadira:blaze-layout | X | |||
kadira:flow-router | X | |||
less | X | |||
meteor | X | |||
meteor-base | X | X | X | |
mobile-experience | X | X | X | |
mongo | X | X | X | |
practicalmeteor:mocha | X | |||
reactive-var | X | X | X | |
server-render | X | |||
shell-server | X | X | X | |
standard-minifier-css | X | X | X | X |
standard-minifier-js | X | X | X | X |
static-html | X | X | ||
tracker | X | X | X | |
webapp | X |
meteor login / logout
Log in and out of your account using Meteor’s authentication system.
You can pass METEOR_SESSION_FILE=token.json
before meteor login
to generatea login session token so you don’t have to share your login credentials withthird-party service providers.
Once you have your account you can log in and log out from the command line, andcheck your username with meteor whoami
.
meteor deploy site
Deploy the project in your current directory toGalaxy.
Use —owner
to decide which organization or user account you’d like to deploya new app to if you are a member of more than one Galaxy-enabled account.
You can deploy in debug mode by passing —debug
. Thiswill leave your source code readable by your favorite in-browserdebugger, just like it is in local development mode.
To delete an application you’ve deployed, specifythe —delete
option along with the site.
You can add information specific to a particular deployment of your applicationby using the —settings
option. The argument to —settings
is a filecontaining any JSON string. The object in your settings file will appear on theserver side of your application in Meteor.settings
.
Settings are persistent. When you redeploy your app, the old value will bepreserved unless you explicitly pass new settings using the —settings
option.To unset Meteor.settings
, pass an empty settings file.
meteor update
Attempts to bring you to the latest version of Meteor, and then to upgrade yourpackages to their latest versions. By default, update will not breakcompatibility.
For example, let’s say packages A and B both depend on version 1.1.0 of packageX. If a new version of A depends on X@2.0.0, but there is no new version ofpackage B, running meteor update
will not update A, because doing so willbreak package B.
You can pass in the flag —packages-only
to update only the packages, and notthe release itself. Similarly, you can pass in names of packages(meteor update foo:kittens baz:cats
) to only update specific packages.
Every project is pinned to a specific release of Meteor. You can temporarily tryusing your package with another release by passing the —release
option to anycommand; meteor update
changes the pinned release.
Sometimes, Meteor will ask you to run meteor update —patch
. Patch releasesare special releases that contain only very minor changes (usually crucial bugfixes) from previous releases. We highly recommend that you always run update—patch
when prompted.
You may also pass the —release
flag to act as an override to update to aspecific release. This is an override: if it cannot find compatible versions ofpackages, it will log a warning, but perform the update anyway. This will onlychange your package versions if necessary.
meteor add package
Add packages to your Meteor project. By convention, names of community packagesinclude the name of the maintainer. For example: meteor add iron:router
. Youcan add multiple packages with one command.
Optionally, adds version constraints. Running meteor add package@1.1.0
willadd the package at version 1.1.0
or higher (but not 2.0.0
or higher). If youwant to use version 1.1.0
exactly, use meteor add package@=1.1.0
. You can also‘or’ constraints together: for example, meteor add 'package@=1.0.0 || =2.0.1'
means either 1.0.0 (exactly) or 2.0.1 (exactly).
To remove a version constraint for a specific package, run meteor add
againwithout specifying a version. For example above, to stop using version 1.1.0
exactly, run meteor add package
.
meteor remove package
Removes a package previously added to your Meteor project. For alist of the packages that your application is currently using, runmeteor list
.
This removes the package entirely. To continue using the package,but remove its version constraint, use meteor add
.
Meteor does not downgrade transitive dependencies unless it’s necessary. Thismeans that if running meteor add A
upgrades A’s parent package X to a newversion, your project will continue to use X at the new version even after yourun meteor remove A
.
meteor list
Lists all the packages that you have added to your project. For each package,lists the version that you are using. Lets you know if a newer version of thatpackage is available.
meteor add-platform platform
Adds platforms to your Meteor project. You can add multipleplatforms with one command. Once a platform has been added, youcan use ‘meteor run platform‘ to run on the platform, and meteor build
to build the Meteor project for every added platform.
meteor remove-platform platform
Removes a platform previously added to your Meteor project. For alist of the platforms that your application is currently using, seemeteor list-platforms
.
meteor list-platforms
Lists all of the platforms that have been explicitly added to your project.
meteor mongo
Open a MongoDB shell on your local development database, so that youcan view or manipulate it directly.
For now, you must already have your application running locallywith
meteor run
. This will be easier in the future.
meteor reset
Reset the current project to a fresh state. Removes the localmongo database.
This deletes your data! Make sure you do not have any information youcare about in your local mongo database by running
meteor mongo
.From the mongo shell, useshow collections
anddb.collection.find()
to inspect your data.
For now, you can not run this while a development server isrunning. Quit all running meteor applications before running this.
meteor build
Package this project up for deployment. The output is a directory with severalbuild artifacts:
- a tarball (.tar.gz) that includes everything necessary to run the application server (see the
README
in the tarball for details). Using the--directory
option will produce abundle
directory instead of the tarball. - an unsigned
apk
bundle and a project source if Android is targetted as a mobile platform - a directory with an Xcode project source if iOS is targetted as a mobile platform
You can use the application server bundle to host a Meteor application on yourown server, instead of deploying to Galaxy. You will have to dealwith logging, monitoring, backups, load-balancing, etc, all of which we handlefor you if you use Galaxy.
The unsigned apk
bundle and the outputted Xcode project can be used to deployyour mobile apps to Android Play Store and Apple App Store.
By default, your application is bundled for your current architecture.This may cause difficulties if your app contains binary code due to,for example, npm packages. You can try to override that behaviorwith the —architecture
flag.
meteor lint
Run through the whole build process for the app and run all linters the appuses. Outputs all build errors or linting warnings to the standard output.
meteor search
Searches for Meteor packages and releases, whose names contain the specifiedregular expression.
meteor show
Shows more information about a specific package or release: name, summary, theusernames of its maintainers, and, if specified, its homepage and git URL.
meteor publish
Publishes your package. To publish, you must cd
into the package directory, login with your Meteor Developer Account and run meteor publish
. By convention,published package names must begin with the maintainer’s Meteor DeveloperAccount username and a colon, like so: iron:router
.
To publish a package for the first time, use meteor publish —create
.
Sometimes packages may contain binary code specific to an architecture (forexample, they may use an npm package). In that case, running publish will onlyupload the build to the architecture that you were using to publish it. You canuse publish-for-arch
to upload a build to a different architecture from adifferent machine.
meteor publish-for-arch
Publishes a build of an existing package version from a different architecture.
Some packages contain code specific to an architecture. Running publish
byitself, will upload the build to the architecture that you were using topublish. You need to run publish-for-arch
from a different architecture toupload a different build.
For example, let’s say you published name:cool-binary-blob from a Mac. If youwant people to be able to use cool-binary-blob from Linux, you should log into aLinux machine and then runmeteor publish-for-arch name:cool-binary-blob@version
. It will notice that youare on a linux machine, and that there is no Linux-compatible build for your packageand publish one.
Currently, the supported architectures for Meteor are 32-bit Linux, 64-bit Linuxand Mac OS. Galaxy’s servers run 64-bit Linux.
meteor publish-release
Publishes a release of Meteor. Takes in a JSON configuration file.
Meteor releases are divided into tracks. While only MDG members can publish tothe default Meteor track, anyone can create a track of their own and publish toit. Running meteor update
without specifying the —release
option will notcause the user to switch tracks.
To publish to a release track for the first time, use the —create-track
flag.
The JSON configuration file must contain the name of the release track(track
), the release version (version
), various metadata, the packagesspecified by the release as mapped to versions (packages
), and the package &version of the Meteor command-line tool (tool
). Note that this means thatforks of the meteor tool can be published as packages and people can use them byswitching to a corresponding release. For more information, runmeteor help publish-release
.
meteor test-packages
Test Meteor packages, either by name, or by directory. Not specifying anargument will run tests for all local packages. The results are displayed in anapp that runs at localhost:3000
by default. If you need to, you can pass the—settings
and —port
arguments.
meteor admin
Catch-all for miscellaneous commands that require authorization to use.
Some example uses of meteor admin
include adding and removing packagemaintainers and setting a homepage for a package. It also includes varioushelpful functions for managing a Meteor release. Run meteor help admin
formore information.
meteor shell
When meteor shell
is executed in an application directory where a serveris already running, it connects to the server and starts an interactiveshell for evaluating server-side code.
Multiple shells can be attached to the same server. If no server iscurrently available, meteor shell
will keep trying to connect until itsucceeds.
Exiting the shell does not terminate the server. If the server restartsbecause a change was made in server code, or a fatal exception wasencountered, the shell will restart along with the server. This behaviorcan be simulated by typing .reload
in the shell.
The shell supports tab completion for global variables like Meteor
,Mongo
, and Package
. Try typing Meteor.is
and then pressing tab.
The shell maintains a persistent history across sessions. Previously-runcommands can be accessed by pressing the up arrow.
meteor npm
The meteor npm
command calls thenpm
version bundledwith Meteor itself.
Additional parameters can be passed in the same way as the npm
command(e.g. meteor npm rebuild
, meteor npm ls
, etc.) and thenpm documentation should be consulted for thefull list of commands and for a better understanding of their usage.
For example, executing meteor npm install lodash —save
would install lodash
from npm to your node_modules
directory and save its usage in yourpackage.json
file.
Using the meteor npm …
commands in place of traditional npm …
commandsis particularly important when using Node.js modules that have binarydependencies that make native C calls (like bcrypt
)because doing so ensures that they are built using the same libaries.
Additionally, this access to the npm that comes with Meteor avoids the need todownload and install npm separately.
meteor node
The meteor node
command calls thenode
version bundled with Meteor itself.
This is not to be confused with
meteor shell
, which providesan almost identical experience but also gives you access to the “server” contextof a Meteor application. Typically,meteor shell
will be preferred.
Additional parameters can be passed in the same way as the node
command, andthe Node.js documentationshould be consulted for the full list of commands and for a better understandingof their usage.
For example, executing meteor node
will enter the Node.jsRead-Eval-Print-Loop (REPL)interface and allow you to interactively run JavaScript and see the results.
Executing meteor node -e "console.log(process.versions)"
wouldrun console.log(process.versions)
in the version of node
bundled with Meteor.