关于tmodjs的详情请查看github:https://github.com/aui/tmodjs#%E5%AE%89%E8%A3%85
下面说下tmodjs的详细安装过程:
- 在nodejs官网,根据操作系统的类型下载node.js,并安装。nodejs官网地址:http://nodejs.org/
- 安装完成后可以在开始菜单中找到node.js的安装信息,如下。
- 通过系统的CMD命令,进入系统的命令行模式,并进入node.js的安装目录。在安装目录下执行tmodjs的安装。如下。
- 通过开始菜单,打开node.js中的“Node.js command prompt”,在该命令窗口下,跳转到需要生成template的文件目录,并执行tmod命令。看到命令执行完成后,显示“Waiting”,表明正在等待客户端中的模板html文件发生改变,一旦发生改变将自动生成template.js。
具体的template.js安装及参数的配置请参考tmodjs在github中文档。
问题:在安装tmodjs或express出现错误,提示如下:
npm ERR! System Windows_NT 6.1.7601 npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "update" npm ERR! cwd C:\work\selink npm ERR! node -v v0.10.4 npm ERR! npm -v 1.2.18 npm ERR! syscall write npm ERR! code EIO npm ERR! errno EIO
解决:通过命令行设置一下编码方式,错误参考https://github.com/npm/npm/issues/3858 , 解决方式如下:
There are two ways to run into this problem, neither of them bugs in npm itself: Something unspecified is wrong with I/O on the system – the hard drive is going bad, something's wrong with the block device driver, the OS is having a meltdown, or You're running Windows and somehow you've ended up with a system codepage installed that's incompatible with how you're naming things. chcp 850 in cmd.exe should fix this.