Meteor 0.8.0, Iron Router and Discover Meteor - meteor

Meteor 0.8.0 is out with the new Blaze rendering, which is great... for the future.
At the present I can't run my Iron Router powered app: updated -> ran meteor -> white browser screen. I guess I'll roll back to 0.7.2. but that gives me a fuzzy feeling. Its like have a new computer with no internet connection. Is there any fix for these changes? At least for Iron Router?
Note Comment (although it was in the title):
I am learning meteor using the Discover Meteor book, it's a great book written by same author of Iron Router; I love it. However, if meteor changed that much am I wasting my time?
Update
#iAmME's solution works great! I solved it another way that also fixed iron-router-progress by modifying the smartpackage. Just wanted to post it if it helps anyone:
{
"packages": {
"blaze-layout": {},
"iron-router":
{
"git": "https://github.com/EventedMind/iron-router.git",
"branch": "blaze-integration"
},
"iron-router-progress":
{
"git": "https://github.com/Multiply/iron-router-progress.git",
"branch": "blaze-integration"
}
}
}

Just faced the same issue,
Did the following and works fine
It occurs mostly because of the iron-router package and few other packages which are using spark as dependency and first re-install the iron-router like below
meteor remove iron-router
rm -rf packages/iron-router
mrt update
mrt add iron-router
Just re-installing the iron-router will update you to the new version and also it installs blaze-Layout automatically with the iron-router(which is the new templating system).
After updating iron-router,Even now if you are getting spark is not defined error,check which package is using spark and update those packages too.

You have to update your iron-router package. Check out the Iron Router github page https://github.com/EventedMind/iron-router for information on what's new in their 0.7.0 release. It works for Meteor 0.8.0.

Related

Meteor upgrade to 1.0.3.1 now I get ReferenceError: moment is not defined

After upgrading to Meteor 1.0.3.1 I now get this error
ReferenceError: moment is not defined
I can see here that it upgraded the momentjs to a newer version
momentjs:moment added, version 2.8.4
mrt:moment removed from your project
tsega:bootstrap3-datetimepicker upgraded from 3.1.3_1 to 3.1.3_3
Here is the code from the first place that I get that error
var today = new moment().format('MM/DD/YYYY');
Seems like it should still work. I tried to reinstall it and now the app is crashing.
Has anybody else had this issue?
I think the moment package on Atmosphere is actually up to 2.9.0. Try either running a meteor update, or manually remove the moment package (meteor remove momentjs:moment) and re-adding it.
Also, you shouldn't need to use new moment(), just moment(), like this:
var today = moment().format('MM/DD/YYYY');

Velocity hangs with no errors when testing meteor app

I'm pretty new to meteor so I'm just writing a simple app but really want to make it as TDD as possible (worth mentioning I'm also new to Mocha). So I've added the mike:mocha and velocity:core packages and written a super simple initial test just to see if I can get things to work, which I've added at tests/mocha/client/tests.js:
if (typeof MochaWeb != 'undefined') {
MochaWeb.testOnly(function () {
describe('Friends are added successfully', function () {
it('Should add a new person to the Friend collection', function(done) {
var friendId = Friends.insert(
{ firstName: 'New',
lastName: 'Friend'});
var friend = Friends.findOne({'firstName':'New'});
console.log(friend);
chai.assert.equal(friend.length === 1);
done();
});
});
})
;}
My problem is that when I run either the meteor command or meteor --test, I get nothing in the terminal apart from the expected:
=> Started proxy.
=> Started MongoDB.I20150115-22:31:03.216(0)? [velocity] chokadir watching /correctDirectory/tests
=> Started your app.
=> App running at: http://localhost:3000/
But then Velocity just hangs (a blue circle with a wider blue ring around it - no greens or red), pulsating and not providing any feedback whatsoever. None on the developer console or the terminal either! I tried checking localhost:5000 but this comes back as 'not available'.
Not sure how to start with figuring this one out!
Thanks in advance to anyone who can help :)
I was able to get your example to work on my local, so I would recommend checking versions of your software and get that in line first.
Here are a few things you can check, but I'll show what's on my machine for comparison:
Check your version of node
node -v
v0.10.35
If necessary, upgrade node. On my mac, I do the following:
brew update && brew upgrade node
If you don't have a mac, you might want to google for upgrade instructions for your machine's platform.
Check your package versions
meteor list
meteor-platform 1.2.1
mike:mocha 0.5.1
velocity:core 0.4.5
Check your meteor version
meteor --version
Meteor 1.0.2.1
If necessary, upgrade meteor and related packages
meteor update
If none of that helps, please post additional information. Additionally, you can also create an issue on Github for Velocity.

Iron router: Error: Couldn't find a template named "/" or "". Are you sure you defined it?

I have trouble setting up a simple iron:router example: (docs, sample app)
meteor create testapp
cd testapp
home.html:
<template name="Home">
<h1>Welcome</h1>
home
</template>
router.js:
Router.route('/', function () {
this.render('Home'); // Also tried 'home'
});
Starting the server:
meteor
Then I get (client side):
Exception from Tracker recompute function: Error: Couldn't find a template named "/" or "". Are you sure you defined it?
at null._render (http://localhost:3000/packages/iron_dynamic-template.js?32038885cb1dad7957291ffebfffcb7f8cd57d20:239:17)
at doRender (http://localhost:3000/packages/blaze.js?88aac5d3c26b7576ac55bb3afc5324f465757709:1853:25)
...
What am I doing wrong ?
Note: I get the exact same error if I clone the example application (basic.html and basic.js).
meteor list
autopublish 1.0.1 Publish the entire database to all clients
insecure 1.0.1 Allow all database writes by default
iron:router 0.9.4 Routing specifically designed for Meteor
meteor-platform 1.1.2 Include a standard set of Meteor packages in your app
Also:
meteor --version
Meteor 0.9.4 <- Why all standard packages and meteor platform are > 1.0 and this is 0.9.4 ?
Currently, there are two versions of iron:router.
iron:router#0.9.4 is the one added by default when you type meteor add iron:router, this version is the latest in the "legacy" branch of iron:router that came up more than one year ago, it's the one that everyone is probably still using, although they should definitely update to...
iron:router#1.0.0-preX with X = 4 as of 20/10/2014, which is a complete rewrite of the package intended to be backward compatible, but introducing a new, nicer and polished API. This version will likely be set as default when meteor hits 1.0.0 later this year. The problem is that github page of iron:router shows this particular branch (1.0.0-pre4) along with examples that people believe are usable with 0.9.4.
This means that you are most likely using the wrong version of iron router, remove it with meteor remove iron:router and meteor add iron:router#1.0.0-pre4 instead.
Recommended reading to learn about the latest iron:router syntax :
http://eventedmind.github.io/iron-router/
Sometimes the guide is not completely up-to-date with the pre-release version, if you want to keep up with the latest stuff take a look at github issues.

Error when using iron:router with Meteor 0.9.3.1

I am experimenting with Meteor and iron:router. I git cloned the examples from https://github.com/EventedMind/iron-router.git. I then cd-ed into samples/basic, and ran meteor update and meteor. My meteor version is 0.9.3.1
When I navigated to the website an error is displayed in console and the page is empty. The error is as below:
Exception from Tracker recompute function: Error: Couldn't find a template named "/" or "". Are you sure you defined it?
at null._render (http://localhost:3000/packages/iron_dynamic-template.js?32038885cb1dad7957291ffebfffcb7f8cd57d20:239:17)
at doRender (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1853:25)
at http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1795:16
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:2029:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1794:18)
at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:288:36)
at new Tracker.Computation (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:206:10)
at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:476:11)
at Blaze.View.autorun (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1793:19)
at http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1847:10 debug.js:41
Can someone kindly advise what I am doing incorrectly?
Thanks in advance.
The reason you have this issue is there is a discrepancy between the iron-router#1.0.0-pre-x (like a Beta for 1.0) and the currently in use 0.9.x version of iron router.
The old notation for defining a route for http://localhost:3000/route, for the template route would be as follows:
Router.route("route", { path : '/' });
However in the new version, which is currently on github on devel (which I presume the examples are based on is as follows):
Router.route("/", function() {
this.render("route");
});
The problem is using the notation on the bottom would lead to the error Couldn't find a template named "/" since the first param of the Route.route is now a path instead of a template.
The way to fix this is to either use the pre-release version of iron router (the version string can be found in the package.js file on github):
meteor remove iron:router
meteor add iron:router#1.0.0-pre3
Or to use the old notation by looking at an example bundled with a release on github instead of the devel branch like this one: https://github.com/EventedMind/iron-router/tree/v0.9.2-rc0

meteorite local packages, having trouble setting the global namespace?

My current project is at https://github.com/jimmack1963/localPackages.git.
I am trying to get this code to work:
console.log("You pressed the button, " + MyName);
where MyName comes from a package called simple, that is JUST LOCAL. Per 6.5, am exporting via
Package.on_use(function (api, where) {
api.add_files(['constant.js'], 'client');
//below added per possible suggestion from Nathan, had no effect.
api.use('constant.js', 'client');
if (api.export)
api.export('MyName');
});
Am trying to factor my code out to local packages. This is not about publishing packages, but about using local ones, which is referred to in many places. My package is simply trying to publish a string, MyName. But the project wants none of it. "MyName is not defined."
I copy the technique in 'Discover Meteor,' but it doesn't work for me, and I try other things. Have had a lot of success in Meteor in general.
This spec seems to be changing. I get the 6.5 export requirement, but easily find contradictory advise about the base project's need to add that project in smart.json (not the one in the package). Most references don't list that as a requirement at all.
I've tried
{
"packages": {
"simple" : {
"path": "packages/simple"
}
}
}
and putting it into git and trying from a different project:
{
"packages": {
"simple" : {
"git": "https://github.com/jimmack1963/localPackages.git"
}
}
}
For the latter, pleasingly, the installer was smart enough to burrow down and extract the package itself, ignoring the project wrapping it in the git project. Nice! So, I have the same problem when I install the package directly from git, still not published to the world.
Ubuntu 13.04
Meteorite version 0.6.11
Meteor Release 0.6.5.1
I had the same issue after migrating to 0.6.5 -
You only get 'exported' variables from packages you explicitly "use"; Packages "use" other packages by calling .use inside Package.on_use, projects "use" packages by adding them to .meteor/packages
Additionally, it seems to be quite picky about exporting variables, and wont currently export ones preceded with this.

Resources