Any body have this error on the console. "Cannot find module 'meteor/themeteorchef:bert"

Guys. I’m using the module that works beautifully. However, on the console I get an error any time I use the library throughout my app.

I would be glad to show my code.

Often that just means the package is not installed. Have you reinstalled the package yet?

Yes. I’ve installed it several times but no luck. The library is working fine but the meteor compiler can’t find it. At least that is how it appears.

Try going back to square 1:

  1. meteor reset
  2. delete node_modules directory
  3. meteor npm install
  4. meteor

I have been successfully using Bert alert in my app for quite a while now. I do not import it anywhere, no need if you use the meteor packaging system Bert will expose a single global variable: Bert

@brucejo thanks so much for the quick reply. I followed your steps and I removed on of the import references but now I get more errors anywhere I use Bert. Below is the meteor compiler output

client/imports/app/root/crm/customers/address/address-container.component.ts (90, 15): Cannot find name ‘Bert’.
client/imports/app/root/crm/customers/address/address-container.component.ts (96, 4): Cannot find name ‘Bert’.
client/imports/app/root/crm/customers/parties/parties-container.component.ts (4, 22): Cannot find module ‘meteor/themeteorchef:bert’.
client/imports/app/root/crm/customers/reptech/rep-container.component.ts (4, 22): Cannot find module ‘meteor/themeteorchef:bert’.
client/imports/app/root/crm/customers/salesInfo/salesInfo-container.component.ts (3, 22): Cannot find module ‘meteor/themeteorchef:bert’.

How did you add the package?

There are 2 ways I know of.

add this line to .meteor/packages:

themeteorchef:bert

or

meteor add themeteorchef:bert

Which will add it for you

When you type meteor list does themeteorchef:bert show up in the list?

I used the command line “meteor add themeteorchef:bert”. I also called the meteor list command I below is what I got back:
C:\Dev-Nuvol9-1\nuvol9-crm>meteor list

accounts-password          1.3.3  Password support for accounts
angular2-compilers         0.6.6  Angular 2 Templates, HTML and TypeScript compilers for Meteor
autopublish                1.0.7  (For prototyping only) Publish the entire database to all clients
dispatch:mocha-phantomjs   0.1.9  Run package or app tests with Mocha+PhantomJS and report all results in the server console
es5-shim                   4.6.15  Shims and polyfills to improve ECMAScript 5 support
http                       1.2.10  Make HTTP calls to remote servers
hwillson:stub-collections  1.0.3  Stub out Meteor collections with in-memory local collections.
insecure                   1.0.7  (For prototyping only) Allow all database writes from the client
meteor-base                1.0.4  Packages that every Meteor app needs
mobile-experience          1.0.4  Packages for a great mobile user experience
mongo                      1.1.14  Adaptor for using MongoDB and Minimongo over DDP
practicalmeteor:mocha      2.4.5_6  Write package tests with mocha and run them in the browser or from the command line with spacejam.
reactive-var               1.0.11  Reactive variable
service-configuration      1.0.11  Manage the configuration for third-party services
session                    1.1.7  Session variable
shell-server               0.2.1  Server-side component of the `meteor shell` command.
standard-minifier-css      1.3.2  Standard css minifier used with Meteor apps by default.
standard-minifier-js       1.2.1  Standard javascript minifiers used with Meteor apps by default.
themeteorchef:bert         2.1.1  A client side, multi-style alerts system for Meteor.
tracker                    1.1.1  Dependency tracker to allow reactive callbacks
xolvio:cleaner             0.3.1  Gives you methods to clear your Mongo database and collections for testing purposes

As you can see it is there third from the bottom.

Also in the .meteor/packages file the entry listed there is:
themeteorchef:bert

Thanks for showing me all this. I did not know how this works. So still I get these package errors. Very annoying.

Indeed weird :slight_smile:.

take a look here .meteor\local\build\programs\web.browser\packages . You should see 2 things:

  1. folder named themeteorchef_bert
  2. file named: themeteorchef_bert.js

What are .ts files? Do they have import statements? Maybe try removing all imports of meteor/themeteorchef:bert from all files? Shooting in the dark here…

Also, can you create a new simple project and add bert to it? E.g.:

  1. Go to a fresh location (not inside a meteor project) and run meteor create test
  2. Add bert to the project test
  3. Make a bert call in the main.js file and verify it works.

I often times find going back to a simpler case can help illuminate my issue.

@brucejo, again thanks so much for your help.
I’m running on windows. And ts files are TypeScript files.

Here is the file location
C:\Users\sosawise\AppData\Local.meteor\packages\themeteorchef_bert\2.1.1\web.browser

There is a bert.js file in there. So I wonder if that is the problem that in windows the name of the file should be changed to themeteorchef_bert.js.

I will try your suggestion of creating a small project and adding it. See what happens.

You should have said right from the start that you’re using TypeScript. The error message isn’t very helpful as it can point you in the wrong direction unless you know what it’s about.

Basically, you’re missing a declaration file. For most Meteor modules aside from the included ones you’ll need to create those yourself.

You need to create that file yourself. It’s not that complicated. Basically, you place a file named themeteorchef-bert.d.ts somewhere in your project. Root folder will do fine. It also doesn’t need to be named thus - only the ending *.d.ts is important.

For this module, the definitions could look like this:

declare module 'meteor/themeteorchef:bert' {
   module Bert {
      function alert(message: string, type: string, style:string, icon?:string):void;
      function alert(options:any):void;
      const defaults:any;
  }
}

I’m sure that’s not complete but should get you going.

1 Like

@rhywden, and @brucejo you guys are awesome. Sorry I’m new to Meteor, this is my first app. So a lot to learn.

Thanks again.

You should read up on this. It’ll help you create basic definition files yourself.

http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

Also, the first answer here gives an overview of when you’ll need to actually write one yourself:

Oh, and you only need to include the things you need in this declarations file.