If you've setup Tern for Spacemacs, and you're seeing the following error:
Undeclared variable or function 'module'
add the following line to the user-init section of your .spacemacs file:
(setq js2-include-node-externs t)
For example, here's what my user-init section looks like:
In your js2-mode.el file (see .emacs.d/elpa/js2-mode/), there's a section that looks like this:
(defvar js2-node-externs (mapcar 'symbol-name '(__dirname __filename Buffer clearInterval clearTimeout require console exports global module process setInterval setTimeout querystring setImmediate clearImmediate)) "Node.js externs. Set `js2-include-node-externs' to t to include them.")
Setting this variable helps define module for js2-mode.
Thanks to this answer on Stack Exchange for helping me figure this out.