TypeError: Package.describe is not a function at meteorInstall.package.js

  • While trying to understand how package.js works I copied the simple-todos example from the meteor blaze tutorial.
    mkdir tempspace
    cd tempspace; meteor create simple-todos
    cd simple-todos; meteor
  • Then I created the file package.js in the simple-todos directory, and added the following content:
    Package.describe({
        name: "demo:todos",
        summary: "A zero-config todo",
        version: "0.0.1",
        git: "not available"
    });

and then received this error in the terminal:

W20170920-13:59:43.473(-7)? (STDERR) /home/myname/.meteor/packages/meteor-tool/.1.5.2.1q1fcxy++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20170920-13:59:43.491(-7)? (STDERR) 						throw(ex);
W20170920-13:59:43.496(-7)? (STDERR) 						^
W20170920-13:59:43.501(-7)? (STDERR) 
W20170920-13:59:43.504(-7)? (STDERR) TypeError: Package.describe is not a function
W20170920-13:59:43.506(-7)? (STDERR)     at meteorInstall.package.js (package.js:1:9)
  • This makes me think there is an import problem, as the compiler seems to not know about Package.describe.

  • This of course is a mock problem… The real problem is with a published package that has the same problems with package.js on my development environment. I just figured I would simplify the troubleshooting and try a known good app.


Edit 21-Sept 2017
Following @jamgold and @copleykj advice from below, here are the results:

$ meteor create simple-todos --package
$ cd simple-todos; ls -al
 .
 ..
 package.js
 README.md
 simple-todos.js
 simple-todos-tests.js

$ cd ..
$ meteor create simple-todos
$ cd simple-todos; ls -al
 .
 ..
 client
 .gitignore
 .meteor
 node_modules
 package.js
 README.md
 server
 simple-todos.js
 simple-todos-tests.js

$ meteor

Same error:

" /home/myname/.meteor/packages/meteor-tool/.1.5.2.1q1fcxy++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/dev_bundle/server-lib/node_modules/fibers/future.js:280"
" TypeError: Package.describe is not a function"

Which leads me to think there is either a problem with:

  • my install of meteor 1.5.2
  • or perhaps my operating system Fedora 18 is too old
  • or my hardware is too old, and needs an upgrade.

Did I miss something in the api doc about how to add package.js?
At this point my guess is, probably not.

Don’t you have to do meteor create simple-todos --package to be able to use Package?

3 Likes

@jamgold is correct. A package.js file added to a meteor application project has no significant meaning, it is just another file that the Meteor build tool will find and add to your project. If though, you create a folder inside your project’s packages folder that contains a package.js file, then Meteor will recognize this as a package and execute the file within a special context during the build and the Package variable will be available.

2 Likes