-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I am having issues importing the sdk for usage in that i am getting this error. i am using nodeJS v20.x, npm 10.5, i will greatly appreceate a nudge on this. Thanks alot.
My env : {
"intasend-node": "^1.1.0",
}
` Error: Cannot find module '/Users/*****/VisualStudioCodeProjects/paysplit/node_modules/intasend-node/dist/intasend.js'. Please verify that the package.json has a valid "main" entry
code: 'MODULE_NOT_FOUND',
path: '/Users/*****/VisualStudioCodeProjects/paysplit/node_modules/intasend-node/package.json',
requestPath: 'intasend-node'
code example
const IntaSend = require('intasend-node');
require('dotenv').config({path : "./../.env"})
class IntaSendService {
constructor(publishableKey, secretKey, isTest) {
this.intasend = new IntaSend(publishableKey, secretKey, isTest);
this.collection = this.intasend.collection();
}
mpesaStkPush(data) {
return this.collection.mpesaStkPush(data)
.then((resp) => {
console.log('STK Push Resp:', resp);
return resp;
})
.catch((err) => {
console.error('STK Push Resp error:', err);
throw err;
});
}
}
module.exports = IntaSendService
`