How to setup Meteor-1.3beta + React + React-router via NPM
:
Special thanks to ciwolsey on freenode/#meteor whose instructions I’m sharing below.
Feel free to reply with corrections/improvements.
1) Ensure Meteor-1.2 and node.js are both installed.
2) Create a new meteor-1.2 project. For example, my project is named helloworld.
$ meteor create helloworld
3) Enter your new project’s directory:
$ cd ~/helloworld
4) Update the new project to Meteor-1.3beta (official instructions here)
$ meteor update --release 1.3-beta.12
5) Enable module support introduced in the Meteor-1.3beta.
$ meteor add modules
6) Initialize npm to generate your dependency list (package.json):
$ npm init
*****note: you may accept all the default values requested --none of the options matter.
7) Install react, react-router and dependencies via npm:
$ npm install history react react-dom react-router --save
*****note-1: You can view all available version of a package via “npm view versions”.
*****note-2: At the end of the installation, npm may warn you about missing dependencies. For example, I was originally told that “…react-router@1.0.3 requires a peer of history@^1.1.70…”. To correct this, I simply installed history.
*****note-2: You can also ignore warnings like: “npm WARN EPACKAGEJSON helloworld@1.0.0. No repository field.” These are just because you didn’t enter every requested detail during ‘npm init’.
8) Delete the three .html, .css and .js files located inside ~/helloworld/.
Within ~/helloworld/ you should now only have the following:
~/helloworld/.meteor
& ~/helloworld/node_modules
& ~/helloworld/package.json
9) Create a ‘client’ folder inside ~/helloworld/ that contains main.html and main.jsx:
~\helloworld\client\main.html
& ~\helloworld\client\main.jsx
10) Edit main.html and main.jsx as follows:
11) Start the app.
$ meteor
Check your browser’s console for any errors then head to 127.0.0.1:3000 where you should see ‘Hello World’ printed --Meteor_1.3, React and React-Router are now setup!
Be sure to checkout the What is the recommended folder structure for Meteor 1.3? thread