ShahiM
ShahiM

Reputation: 3268

error when setting up loggly/winston

I am following the steps outlined here to configure loggly in my nodejs app :

npm install winston
npm install winston-loggly-bulk

and in index.js :

var winston = require('winston');
require('winston-loggly-bulk');
winston.add(winston.transports.Loggly, {
token: "8ea17e10-bfce-4f78-bc18-51ab6c61f78c",
subdomain: "qbesdeveloper",
tags: ["Winston-NodeJS"],
json:true
});

but I keep getting this error :

Error: Cannot find module 'loggly'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/user/totoapi/node_modules/winston-loggly-bulk/lib/winston-loggly.js:10:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/user/totoapi/index.js:10:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)

Upvotes: 3

Views: 947

Answers (2)

mostlyjason
mostlyjason

Reputation: 138

I just wanted to let you know that we updated our documentation and the instructions are now correct https://www.loggly.com/docs/nodejs-logs/. The maintainer of the original package was not responding to our pull requests so we forked it and created a new package version that allows us to do better quality control and update it faster. Thanks for sending us a tweet.

Upvotes: 1

ShahiM
ShahiM

Reputation: 3268

Well, I reached out to Loggly support and they gave me a solution:

The docs say to install just winston and winston-loggly-bulk, but you need to install a third packege loggly too.

npm install winston
npm install loggly
npm install winston-loggly-bulk

I have no idea why they did not mention this in their getting started page. Anyways, I'm gonna leave this here until they update their docs.

Upvotes: 9

Related Questions