Can't create a local package

Tried to do this:

meteor create --package aaabbbccc:simple

It creates a package successfully, only it creates folder packages\simple, not packages\aaabbbccc:simple as some tutorials show. This being Windows 8.1, colons are not allowed in file names.

Then I edit simple.js to add

console.log("simple.js"); and it never gets logged, neither on client nor on server.

meteor list does not list my package, neither it’s listed in .meteor\packages.

What am I doing wrong?


what do you have in package.js in that package\simple ?

In one attempt, I had this:

  api.add_files("aTemplate.html", "client");

I also tried this:

  name: 'simple',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: '',
  // URL to the Git repository containing the source code for this package.
  git: '',
  // By default, Meteor will default to using for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: ''

Package.onUse(function(api) {

Package.onTest(function(api) {

Well, meteor knows your package based on that ‘name’ in package.js

So I would suggest to write there for example

name: 'aaabbbccc:simple'

and than add it using

meteor add aaabbbccc:simple

to your project if you have it in that project’s top level packages folder

It is normal that the folder is called simple. The folder name actually doesn’t matter, you could even rename it to whatever you want. More important is the name you provide in your package.js file.

As @shock already pointed out, the name has to be in the format username:package-name, and package-name does not have to match the folder’s name (though it makes much sense to keep both the same).

The most important thing you were missing is to add the package via meteor add. It is not sufficient to just create the package, it also has to be registered with your application.

Besides this, please also note that you are using the old syntax api.on_use and api.add_files in your first sample. The new syntax is api.onUse and api.addFiles, although both variants are still supported.

It seems as if you’ve taken your first samples from a quite old tutorial.

KR, Waldgeist

Yes, it must be an old tutorial:

It was the only one I could find though. Is there a better one?

That fixed it! Thank you!

I mainly used the Meteor docs on packages
and this tutorial:

1 Like