虽然react-tools已经被弃用,但是对于只想编译JSX的项目仍然可以使用。
首先安装好nodejs运行环境。
用如下命令安装nrm(NPM registry 管理工具):
$ npm install -g nrm
npm WARN deprecated coffee-script@1.7.1: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
C:\Users\******\AppData\Roaming\npm\nrm -> C:\Users\******\AppData\Roaming\npm\node_modules\nrm\cli.js
+ nrm@1.0.2
added 328 packages in 124.447s
$ nrm ls
npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
nj ----- https://registry.nodejitsu.com/
rednpm - http://registry.mirror.cqupt.edu.cn/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/
$ nrm use cnpm
Registry has been set to: http://r.cnpmjs.org/
安装react-tools:
$ npm install -g react-tools
npm W