Eagle1
Eagle1

Reputation: 810

how to manually use an "internal" meteor package?

I'm using meteor and I have accounts-password package installed, so it came with bcrypt. Good thing because I want to use it to manually hash some other data.

I do have this package in my packages.json ("bcrypt": "^4.0.1") and I can see its folder in ./.meteor/packages/npm-bcrypt

However I can't figure out how to use it "manually". I tried importing, I tried simply using bcrypt.hash() but it throws an error saying it is undefined. Tried const bcrypt = require('bcrypt');

How do I do this ?

Upvotes: 0

Views: 113

Answers (1)

Tom Freudenberg
Tom Freudenberg

Reputation: 1367

You need to install this npm to your own project as well

meteor npm install --save bcrypt

and then use import that to your source like

import bcrypt from 'bcrypt';

// this is equivalent to the standard node require:
const bcrypt = require('bcrypt');

Read more at meteor guide

https://guide.meteor.com/using-npm-packages.html

Good luck

Upvotes: 0

Related Questions