Personally, I would steer away from requirejs as it requires you to rewrite your modules to fit their spec, which will eventually become defunct as the Ecmascript standard evolves. 

For the time being, I would advise looking into the 'gulp' streaming build system. Using it, you'll find it extremely easy to pipe your shared js scripts into a publicly accessible directory, which can then be loaded from the client-side. A common technique for converting node js modules into browser scripts is using 'browserify' - magic! 

Process: gulp.src > gulp-browserify > gulp.dest > ??? > Profit. 

Further reading: http://viget.com/extend/gulp-browserify-starter-faq

Sharing JavaScript model code between server and client, is this approach valid?
I recently upgraded (with apt-get dist-upgrade) my Kubuntu and Lubuntu Linux boxes, and now every time I log into one of these machines, I get this message:

tput: No value for $TERM and no -T specified


Here is a screenshot of the exact message:


This happened on both my Lubuntu machine and Kubuntu machine, and it wasn't a problem until after I upgraded; so I suspect that it was not user error.

How can I fix this?

UPDATE

I have tracked this down to my .bashrc file, which is getting called by my .profile file.  Though, the fact that my .bashrc file now runs when I do a GUI login whereas it didn't before I upgraded is a bit weird.  And no, I haven't modified my .bashrc file or my .profile recently.  Also, bash isn't my default shell.

The problem is that I am calling tput in my .bashrc file to set up variables for use in adding color to the prompt.  But at the (inappropriate) time when my .bashrc file now gets run, $TERM is not set.

fgRed=$(tput setaf 1)     ; fgGreen=$(tput setaf 2)  ; fgBlue=$(tput setaf 4)
fgMagenta=$(tput setaf 5) ; fgYellow=$(tput setaf 3) ; fgCyan=$(tput setaf 6)
fgWhite=$(tput setaf 7)   ; fgBlack=$(tput setaf 0)
bgRed=$(tput setab 1)     ; bgGreen=$(tput setab 2)  ; bgBlue=$(tput setab 4)
bgMagenta=$(tput setab 5) ; bgYellow=$(tput setab 3) ; bgCyan=$(tput setab 6)
bgWhite=$(tput setab 7)   ; bgBlack=$(tput setab 0)


Updated question: How should I fix this?  Should I set $TERM myself?  Or should I just not set these variables if $TERM is not set?

UPDATE 2

One solution I tried was to check whether $TERM was set. But this didn't seem to work; I still got the same error message.  Here's the code:

if [ ! "$TERM" = "" ]; then
  #Do stuff here
fi


So apparently $TERM was set, but tput still concluded it wasn't.
