[Solved] How do i use npm modules in meteor


I have downloaded the npm package in my meteor app, i can also see it inside the “node-module” folder. So how do i use that module ?


Here is a guide for that :


Thanx…and yeah i tried using this before and now its working…it wasn’t working before coz i was trying to import in client side script…when i imported in server side script…it worked…


You should definitely be able to import from the client (assuming the module in question doesn’t attempt to use native node methods or access the file system).

Which module, and what errors was it giving you?


well it gives me the error in the import syntax saying such module doesnt exist… “import { CoinPayments } from ‘coinpayments’;” this command
when i use this import statement in server script then no errors.


i am trying to use this module in my meteor js : https://www.npmjs.com/package/coinpayments


OK I have fixed my issue so how can i close this topic


You can’t, but you could explain what you did, in case it helps someone else :slight_smile:


here is how i did it…follow the installation part of npm pakcages from here:https://guide.meteor.com/using-npm-packages.html(only installation of npm) when done go to ur client side js file(preferably). No need to import or stuff…just type the following

const pkg = require('<package-name>');
and thats it you just imported the package and its ready to use. No need of import statements.