     else
       @opts = require("rc")("spacejam",@opts,->)
 
+    if not fs.existsSync(process.cwd() + '/.meteor/packages')
+      #log.error "Error: spacejam needs to be run from within a meteor app folder. Exiting."
+      throw new Error("spacejam needs to be run from within a meteor app folder.")
+
     expect(+@opts["port"],"--port is not a number. See 'spacejam help' for more info.").to.be.ok
 
     @opts["root-url"] ?= Meteor.getDefaultRootUrl(@opts["port"])
 
     packages = @opts._[1..] # Get packages from command line
 
-    _testPackages = null
     if packages.length > 0
-      _testPackages = @_globPackages(@opts["app"],packages)
-
-      if !_testPackages.length > 0
-        log.warn "Package not found"
-        @emit "exit",1
-        return
+      _testPackages = @_globPackages(packages)
+      expect(_testPackages).to.have.length.above 0
 
     args = [
       "--port"



  # TODO: Test
  _globPackages: (app,packages)-> # Use glob to get packages that match the packages arg
    log.debug "Meteor._globPackages()",arguments
    expect(app,"@app should be a string").to.be.a "string"
    expect(packages,"@packages should be and array").to.be.an "array"

    matchedPackages = []

    appPath = path.resolve(app)
    meteorPath = "#{appPath}/.meteor"

    if fs.existsSync(meteorPath)
      cwd = "#{appPath}/packages"
    else
      cwd = appPath

    globOpts = {
      cwd: cwd
    }
    packages.forEach (globPkg)=>
      globedPackages = glob.sync(globPkg, globOpts)
      if globedPackages.length > 0
        globedPackages.forEach (pkg)->
          matchedPackages.push(pkg)
####
#      else
#        log.warn "No packages matching #{packages} have been found."
#        if app is "."
#          log.warn "Make sure you are running spacejam from a meteor app folder. If not, use --app to specify app folder."
####

    return matchedPackages


      "mongo-url"   : process.env.MONGO_URL || null
      "settings"    : null
      "production"  : false
      "release"     : null
    }


