I just updated Meteor to 0.8. Now my app is crashing and I get 'spark is not defined'. I have read some articles stating that this can have something to do with the iron-router package. I'm clueless about what steps I should take to correct this.
The error is because of iron-router package.
You need to update the package.
I just gave answer on this see this
Old Spark rendering engine can be referenced by any of the packages you use in your application, so you get this error until all packages used are updated to Blaze, not only iron-router (this is why #Chris is still getting it).
Check which package is referencing Spark and check for updates.
Until mrt update doesn't automatically get results you can look for a blaze branch of the offending package and use it. For example the accounts-ui-bootstrap-3 package has a blaze branch and you can already use it modifying your smart.json:
"accounts-ui-bootstrap-3": {
"git": "https://github.com/mangasocial/meteor-accounts-ui-bootstrap-3" ,
"branch": "blaze"
},
As suggested in this thread.
Related
Is it possible to get a list of all available packages and their configuration within a running MeteorJS app.
I don't mean the CLI command meteor list but something that could let me check if certain packages are available or not and change the programs behaviour accordingly.
Yes.
Using code from the meteorhacks SSR package as an example, you can see that it does this to check for the existence of the Jade package:
if(Package['mquandalle:jade-compiler']) {
Compilers.jade = Package['mquandalle:jade-compiler'].JadeCompiler;
}
The caveat is that the other package has to be added first.
I am having a problem with using jQuery in my Meteor app. It is undefined.
When I look inside .meteor/versions, I can clearly see:
jquery#1.11.3_2
But when I type $ or jQuery in my Chrome console, I get undefined. Also, I cannot use external packages that use any jQuery; I get undefined is not a function exception.
Manually adding jQuery package by meteor add jquery did not solve the issue.
Any idea why this happens?
jQuery is inside the meteor core and defined as a dependency inside meteor-platform. So I never declare it as a a dependency. Meteor relies heavily on it, so it's unlikely to ever be removed. Unlike underscore, which they stated they will remove in a future release. Meteor always aliases $. So that should work. It can't be an issue with that specific version. I'm running the same without any issues. Here are some things you could try to debug:
Create a new project and check if JQ works
Check if an installed package is causing the problem (by removing them one by one)
Packages get loaded before your code, so that can't be the problem.
From the Meteor docs:
Give users of this package access to another package (by passing in the string packagename) or a collection of packages (by passing in an array of strings [packagename1, packagename2]).
I have no idea what it means.
From this question I know that imply can be employed with use.
What does api.imply do?
What's exactly the difference between api.use and api.imply?
api.use gives a package access to other packages exported symbols.
For example you need to api.use("random") (see how it's done in the accounts-base package) if you want to use the Random symbol in a package code (see how the random package.js is api.exporting Random).
However, meteor adding accounts-base wouldn't give your whole application access to its used packages (random in this case). If your app needs random, you'd still need to meteor add it.
api.imply on the other hand, gives the whole application access to that package exported symbols.
For example, see how accounts-google is api.implying accounts-base.
accounts-base is responsible for exporting the Accounts symbol, when you meteor add accounts-google, not only does accounts-base is also added in your application dependencies, but accounts-base symbols are also made available in your app, specifically because it was implied.
accounts-base is both using Accounts in its own code (api.use) and exporting its dependencies symbols to the whole app (api.imply).
api.imply can be used to make "shadow packages" that are just pulling in some other packages.
For example, at some point MDG renamed the showdown package to markdown, they could just have stated to meteor remove showdown && meteor add markdown, but it would have required some actions on end users.
What they did instead is keeping the showdown package and just make it implying the new markdown package.
If you have something in your app that consumes api from package:name and you install just package package:dependant which has a package:name as a dependency, but you don't use imply here, your api from package:name will not work in the app. It will work only in package:dependant package. You need use imply if you want to use something from package:name outside your package:dependant
I don't know if this is clear ;)
I'm using Velocity with the mike:mocha framework and the chai assertions. Everything is working great, but when it comes time to do stubbing, mocking and spying, I've hit a bit of a roadblock. These aren't core features of mike:mocha or chai, so I found practicalmeteor:chai, which should/may have added spies.
My first stab at finding out whether this is true was to write the following code:
it 'calls update when both documents are present but different', ->
spies.create('log', console, 'log')
which gives me:
ReferenceError: spies is not defined
at packages/velocity:test-proxy/tests/mocha/server/charger_server_doc_spec.coffee:88:9
at wrappedFunc (packages/mike:mocha/server.js:200:1)
at runWithEnvironment (packages/mike:mocha/server.js:156:1)
That implies to me that I've misunderstood what practicalmeteor:chai provides, however, the code I showed in the first example is copied verbatim from the README.
Question: Any tips on getting this to work? Is it a load order issue? The code on Github shows spies and so on are implemented in this package. So I'm a bit stuck.
Thanks!
The package practicalmeteor:chai does not include the practicalmeteor:sinon package which is required to get the spies API included.
They are separate packages because you may not have to use spies when creating basic tests with chai.
If you look at the package.js file in the practicalmeteor:chai package, it does not include the sinon files.
So, just running meteor add practicalmeteor:sinon should solve your problem.
I created a package for atmospherejs.com.
Everything worked as expected but now I want to delete it.
How can I remove it from atmosphere?
I found the following explanation but I guess its not up to date:
https://github.com/oortcloud/atmosphere/issues/53
Prevent packages from showing up in meteor search with meteor admin set-unmigrated. Checkout their blogpost on here.
A new administrative command hides packages from the results of meteor search and meteor show. This is designed to remove mrt-era packages that didn't correctly auto-migrate into the new package system and for cases where authors have changed the name of a package and don't want new developers using the old name. To hide a package, run meteor admin set-unmigrated. Please note that hiding a package does not prevent users from explicitly adding it.
There is no way to do so on the new packageserver as mentioned by tmeasday at the end of the issue.
https://github.com/oortcloud/atmosphere/issues/53#issuecomment-54010716