       @ready = true
       @processing = false
       @emit 'ready', true
-      callback @components if callback
-      @writeCache() if @options.cache
+      unless @options.cache
+        callback @components if callback
+        return
+      @writeCache =>
+        callback @components if callback
+      return
 
     @getCoreComponents (coreComponents) =>
       @components[name] = cPath for name, cPath of coreComponents

  cachePath: ->
    path.resolve @baseDir, './.noflo.json'

  writeCache: ->
    cacheData =
      components: {}
      loaders: @componentLoaders or []

    filePath = @cachePath()
    fs.writeFile filePath, JSON.stringify(cacheData, null, 2),
      encoding: 'utf-8'
    , callback

  readCache: (callback) ->
    filePath = @cachePath()
