Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7924907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:00:56+00:00 2026-06-03T18:00:56+00:00

I’m thoroughly confused on how to use an npm module in Meteor client code.

  • 0

I’m thoroughly confused on how to use an npm module in Meteor client code.

I understand modules like fs would only work server-side, but in this case I’d like to use a simple text module like this for displaying pretty dates:

https://github.com/ecto/node-timeago

I’ve tried installing the module under /public/node_modules,
and it works great on the server-side following these instructions from SO: (
How do we or can we use node modules via npm with Meteor?)

Meteor.startup(function () {
  var require = __meteor_bootstrap__.require
  var timeago = require('timeago')
  console.log(timeago(new Date()))
  ...

However it doesn’t work in the client-side code:

if (Meteor.is_client) {
  var require = __meteor_bootstrap__.require
  var timeago = require('timeago')
  console.log(timeago(new Date()))
  ...

Uncaught ReferenceError: __meteor_bootstrap__ is not defined"

Server-side is sort of useless for me in this case, as I’m trying to render text on the client.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:01:02+00:00Added an answer on June 3, 2026 at 6:01 pm

    I don’t believe you need to use the server side version. Use the npm stuff for server side only and btw, put it in your /public/ as well. Who knows maybe you can call it once it is in your /public/, try it. Or try this.

    Use something like the jquery timeago.js

    Put it in /client/ or something like /client/js

    Create a /client/helpers.js or some such.

    Use a handlebars helper.

    Handlebars.registerHelper('date', function(date) {
      if(date) {
        dateObj = new Date(date);
        return $.timeago(dateObj);
      }
      return 'a long long time ago in a galaxy far away';
    });
    

    Example of calling ‘date’ handlebars helper function from template.

    {{ date created }}
    

    Where date is the handebars helper and created is the date coming out of the meteor/mongo collection.

    See the github Britto project. That is where I got this code snippet and used it in a chat room app I wrote. Works fine.

    There are a couple of others floating out there. Go to madewith.meteor.com and peruse the source of some of the projects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.