How to add Router Package to Meteor Js.I didn't have any idea about this so please help me.I am new to Meteor so is there any best reference for Meteor learn quickly.
With the new version of Meteor this is now:
$ meteor add iron:router
The meteor-router project has shifted to iron-router
You can use meteorite to install it. To meteorite:
npm install -g meteorite
And then you can add iron-router by:
mrt add iron-router
I would strongly recommend iron-router, which can be added with just meteor add iron-router from within your project root directory. However, if you install meteorite, it will give access to all the packages listed on Atmosphere, which include some other routing solutions.
Metor JS does not come with support for routing (i.e. having separate pages) out-of-the-box. But it is easy to add that using the router smart package.
$ mrt add router
But before adding router, you must need to install meteorite, You can install meteorite by using this command.
$ npm install -g meteorite
If your system requires root access to install global npm packages, make sure you use the -H flag:
$ sudo -H npm install -g meteorite
Install meteorite first. before installing the 'router' package you should install couple of other packages too. "HTML5-History-API" and "page-js-ie-support" packages. These are for the router to work in older versions of IE that doesn't support push state API.
mrt add HTML5-History-API
mrt add page-js-ie-support
mrt add router
Iron-router appears to be neither well-engineered (i.e. you can't prevent route changing without Monkey-patch) nor well-maintained at this moment. I recommend considering https://github.com/meteorhacks/flow-router/ as an alternative.
Related
Since Meteor 0.9.0 it's posible to install dependencies from atmospherejs just using the meteor cli without install meteorite package manager.
However, is it posible to install all the dependencies declared in smart.json file without install meteorite (i.e. just using meteor cli)?
Thanks in advance.
smart.json is no longer used since Meteor 0.9. The dependencies of an app are stored in .meteor/packages, and are automatically installed when you run meteor run, and when the app restarts automatically after its files are changed. That is, the meteor tool will update the package catalog and install updated packages automatically.
After I update meteor to 0.8.0, I can't install accounts-ui
Is that my problem or others have the problem too? What should I do?
JubydeMacBook-Air:test juby$ mrt add accounts-ui
/usr/local/lib/node_modules/meteorite/lib/project.js:225
throw("Package named " + pkgName + " doesn't exist in your meteor in
^
Package named accounts-ui doesn't exist in your meteor installation, smart.json, or on atmosphere
Thank for your reading.
Make sure you have meteorite installed: npm install -g meteorite
If you have previously added the accounts-ui package remove it with mrt add accounts-ui then add it back with mrt add accounts-ui.
If you still can't add accounts-ui, make sure it was actually removed from your .meteor/packages file.
You can then launch the app with mrt from the app root directory.
Hope that helps.
i get this when i type mrt add iron-router in my meteor app
this is on a mac
smart.json changed.. installing from smart.json
smart.json changed.. installing from smart.json
✓ iron-router
tag: https://github.com/EventedMind/iron-router.git#v0.5.4
/usr/local/lib/node_modules/meteorite/lib/sources/git.js:108
throw "There was a problem cloning repo: " + self.url;
^
There was a problem cloning repo: https://github.com/EventedMind/iron-router.git
what can i do to install iron-router ?
try
mrt uninstall --system
Then reinstall iron-router again.
If it still happen maybe the author forget to push tag. ( if newer version released)
If u want to use it right now. Clone it into your packages folder
Try:
meteor add iron-router
This is the newer way to install Meteor packages.
Note: Also make sure you run this command in the root directory of your Meteor project.
I am just a newbie in meteor and meteorite. I create a new project by mrt create my-app --branch devel. I have install meteorite by $ sudo -H npm install -g meteorite now when I add the package mrt add bootstrap the packages successfully added but on doing mrt add jade-handlers it wont show anything(either error or sucess) so how can I add the jade-handlerbars packages in my meteor project??
I am using node --version 0.10.11
meteorite --version 0.6.5
release 0.6.4
Thank You in Advance!!!
It may be that your smart.json is pointing at the tag on that package, rather than the git repo itself. (The last update to the package did not include a version bump, so the version of the package you get just by mrt adding it is outdated.)
Try putting this in your smart.json:
"jade-handlebars": {
"git": "https://github.com/SimonDegraeve/meteor-jade-handlebars.git"
}
Just a typo I guess?
mrt add jade-handlebars instead of mrt add jade-handlers
I also just figure it out that you can add the packages from the atmosphere by
mrt add <package> --repoPort=443
Meteorite installs great (I have to use sudo -H npm install -g meteorite as Meteorite's install instructions recommend), and I can then use it to install standard Meteor packages in my projects, e.g. mrt add jquery. But if I try to install any packages from Atmosphere, e.g. mrt add router or mrt add font-awesome, I get this output:
Installing Meteor
branch: https://github.com/meteor/meteor.git#master
Installing smart packages
/usr/local/lib/node_modules/meteorite/node_modules/ddp/node_modules/ws/lib/WebSocket.js:175
else throw new Error('not opened');
^
Error: not opened
at WebSocket.send (/usr/local/lib/node_modules/meteorite/node_modules/ddp/node_modules/ws/lib/WebSocket.js:175:16)
at DDPClient._send (/usr/local/lib/node_modules/meteorite/node_modules/ddp/lib/ddp-client.js:77:15)
at WebSocket.<anonymous> (/usr/local/lib/node_modules/meteorite/node_modules/ddp/lib/ddp-client.js:49:10)
at WebSocket.EventEmitter.emit (events.js:92:17)
at WebSocket.establishConnection (/usr/local/lib/node_modules/meteorite/node_modules/ddp/node_modules/ws/lib/WebSocket.js:576:8)
at ClientRequest.<anonymous> (/usr/local/lib/node_modules/meteorite/node_modules/ddp/node_modules/ws/lib/WebSocket.js:488:25)
at ClientRequest.g (events.js:175:14)
at ClientRequest.EventEmitter.emit (events.js:106:17)
at CleartextStream.socketOnData (http.js:1587:11)
at CleartextStream.read [as _read] (tls.js:477:10)
mrt run works properly though! I'm on Meteor v0.6.3.1 and Meteorite v0.5.1. Would appreciate any ideas, thanks!
Check your node version.
As of today (May 26, 2013), I can replicate this error perfectly (I get the same error message) when I use node v0.10.8.
However, with node node-v0.9.9 the mrt add command works.
The other parts of my environment are:
Ubuntu 12.04 LTS x64
mrt --version
Meteorite version 0.5.1
This is an issue specifically with Node 0.10.8
https://github.com/oortcloud/meteorite/issues/135
I was able to fix the issue by first removing node using these instructions. One exception is I had issues using nvm to install node so I used a package instead:
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
You'll find links to download installer package for the 0.10.7 version of node for all os' here:
http://blog.nodejs.org/2013/05/17/node-v0-10-7-stable/
After the install do a node -v to check the version. If it doesn't look right try a restart. I had to reboot in order to get mine happy for some reason.
If you continue to have issues after reinstalling node then try removing and reinstalling meteorite and meteor. Hope this helps someone having the same issue.