[Meteor 1.5.1] Cannot find module when import NPM package

Hi, everyone, I have encountered this problem when use npm package buffermaker in Meteor 1.5.1. Can anyone help me on it. I have describe the detailed reproduce steps in StackOverflow, it’s very simple.

Maybe I didn’t use it correctly, please give me some help.

modules-runtime.js?hash=8587d18…:231 Uncaught Error: Cannot find module './lib/BufferMaker'
    at makeMissingError (modules-runtime.js?hash=8587d18…:231)
    at require (modules-runtime.js?hash=8587d18…:241)
    at index.js (modules.js?hash=e9fc8db…:1016)
    at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
    at require (modules-runtime.js?hash=8587d18…:238)
    at main.js (main.js:1)
    at fileEvaluate (modules-runtime.js?hash=8587d18…:343)
    at require (modules-runtime.js?hash=8587d18…:238)
    at app.js?hash=3f48780…:101

Did you try:

import BufferMaker from 'buffermaker';

Some if not most modules do a default export meaning that you don’t need the curley braces in your import statement

1 Like

@cloudspider Thank you very much for answering, i have tried this, but not work. This module doesn’t use default export.

If I import it in the server side main.js (test/server/main.js), there is no problem. I don’t know why. And I need to use it in React component, so I need to use it in client side.