Meteor Tips

Based upon student experience, here are some suggestions for better managing your Meteor experience.

Tip: Install handlebars and meteor plugins

Meteor development is so much easier when IntelliJ understands Meteor code. I recommend you install two plugins: Handlebars/Mustache and Meteor.

Go to Preferences > Plugins, and click “Browse repositories”. Then search for “Handlebars” and you should find a plugin named “Handlebars/Mustache”. Install that plugin, which will require a restart. Then do the same to install the Meteor plugin.

Tip: Meteor should be slow to start, but quick to refresh

When you invoke meteor to run your application, you can expect to sometimes wait up to two minutes regardless of your platform or machine specifications. The long time for initial build of a Meteor application is frustrating, but as of Meteor 1.4, it is “normal”.

On the other hand, once Meteor has built the application (i.e. the console prints out the message that you can retrieve the application at localhost:3000), then the “refresh” process upon changes to your code should happen quickly, say within 10 seconds. If refresh is slow, then there is an issue with your environment to investigate.

The Meteor Development Group has indicated that improving initial build time is a priority for an upcoming release.

So, don’t worry about startup times under two minutes. Do worry if startup times are 5 minutes or more, or if refresh times are also slow. This either indicates a problem with your configuration (i.e. a virus checker is running) or in the worst case, a problem with your hardware.

Tip: Stop Meteor before switching branches, then restart

If you switch branches while Meteor is running, you are essentially changing the database and application files out from under the running Meteor process, which will generally lead to strange application behavior.

The safest approach to switch branches during Meteor development is to:

  1. Stop the running Meteor application with control-c.
  2. Switch branches.
  3. Invoke ‘meteor reset’ in the new branch.
  4. Re-start meteor.

Tip: Disable Meteor background downloading

One reason Meteor can be unpredictably slow is because, by default, it checks for updates and downloads them automatically as part of the build process.

Fortunately, you can disable this behavior for a given run of Meteor via a command-line argument:

$ meteor --no-release-check

If you want to disable the behavior globally, then you can set an environment variable:

METEOR_NO_RELEASE_CHECK=1

Note that although Meteor downloads updates in the background, it doesn’t install them into your applications. For each application, you must manually install any updates using the command:

$ meteor update

If you use meteor npm run start with any of the template systems for this class, the no-release-check flag is provided automatically.

Tip: Ignore “pure-Javascript implementation of bcrypt” warning

You may see a warning similar to this when starting up Meteor:

Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
approximately three times slower than the native implementation.
In order to use the native implementation instead, run
         
   meteor npm install --save bcrypt
          
in the root directory of your application.

bcrypt is a password-hashing algorithm used during authentication. Since logins are a low frequency event for your applications in this class, there is no real performance impact of a pure-Javascript implementation. In addition, on Windows, attempting to install the native implementation of bcrypt can be time-consuming and error-prone.

So, don’t worry about this warning.

Tip: reduce IntelliJ “index” time by invalidating caches

If you find that IntelliJ is taking more than 2-3 minutes to index your application when you first create a project, then try “invalidating caches and restarting” using the File > Invalidate caches/Restart menu.

Users have reported that this solves the problem of indices taking many minutes to build.

Tip: ignore ESLint “warnings”, only flag ESLint errors

The package.json files for the template Meteor applications in this class run ESLint with the “quiet” flag, which suppresses warnings:

"scripts": {
    "start": "meteor --no-release-check",
    "lint": "eslint --quiet ./imports"
  },

So that you get the same behavior inside IntelliJ, you need to pass –quiet as an “extra eslint option”. Set this up in the ESLint configuration panel:

Windows-specific Meteor Tips

(Windows) Tip: Disable Windows Virus Scanners (such as Windows Defender Real-Time Protection)

Some Windows users report very slow startup times for Meteor or IntelliJ can be solved by disabling virus scanners.

To determine if this is a problem, use Windows Task Manager to see if another process is using most of the CPU resources while IntelliJ or Meteor is starting up. For example, here is a screen shot of Windows Task Manager when Meteor (i.e. Node.js) is starting up:

As you can see, “antimalware service executable” is using most of the CPU resources. A quick google shows that this program is part of Windows Defender, and the link disabling Windows Real-Time Protection shows how to disable it temporarily.

On Windows, it is unwise to disable Windows Defender permanently as this leaves your computer vulnerable to malware. According to Google, each “temporary disable” of Windows Defender lasts a couple of days.

(Windows) Tip: Remove the association of .js files to Windows Script Host

Some students have reported compiler errors and other problems that were resolved by changing the association of javascript from Windows Script Host to IntelliJ IDEA.

To do this, go to Control Panel > Default Programs, and click on “Associate a file type or protocol with a program”. Then find .js, and change it to IntelliJ IDEA.

(Windows) Tip: Consider Ubuntu on Windows

Windows 10 provides a native Linux environment called Ubuntu on Windows. If you are having problems getting Meteor to run on your Windows machine, consider running it in this environment. Note that you may want to install git and IntelliJ as well as Meteor so that you can do all development in this environment.