cayasso / mongo-oplog

Watch mongodb oplog in a simple way
381 stars 91 forks source link

2.x.x requires babel-runtime #41

Closed tarunbatra closed 7 years ago

tarunbatra commented 7 years ago

I tried to install the package, but got this error while running code: Error: Cannot find module ‘babel-runtime/core-js/object/assign’

My project doesn't use babel. Neither it's in the dependencies of the package. So is it a hidden global dependency?

cayasso commented 7 years ago

Hi @tarunbatra! You don't need Babel to use mongo-oplog if you install it via npm. How are you installing and using the project? What version specifically of mongo-oplog are you using?

tarunbatra commented 7 years ago

Ok. So I went again and checked. 1.1.0 is working form but not 2.0.1. Node version is 6.9.1. It's strange.

cayasso commented 7 years ago

Thanks @tarunbatra I need an example of how you are using the module, maybe a gist or something so I can reproduce the issue and help you.

noamtz commented 7 years ago

This happen to me as well.

Node version 6.9.2, mongo-oplog version 2.0.1 The code:


'use strict';

const MongoOplog  = require('mongo-oplog');
const oplog = MongoOplog('mongodb://127.0.0.1:27017/local', { ns: 'test.posts' })

oplog.tail();

oplog.on('op', data => {
    console.log(data);
});

oplog.on('insert', doc => {
    console.log(doc);
});

oplog.on('update', doc => {
    console.log(doc);
});

oplog.on('delete', doc => {
    console.log(doc.o._id);
});

oplog.on('error', error => {
    console.log(error);
});

oplog.on('end', () => {
    console.log('Stream ended');
});

oplog.stop(() => {
    console.log('server stopped');
});

The error:

Error: Cannot find module 'babel-runtime/core-js/object/assign'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/workspace/poc/node_modules/mongo-oplog/lib/index.js:8:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
tarunbatra commented 7 years ago

@cayasso I'm just using the example in Readme, like @noamtz

cayasso commented 7 years ago

@tarunbatra @noamtz I just released mongo-oplog@2.0.2 with a fix for this issue. The issue was that the babel-polyfill was placed in devDependencies instead of dependencies my bad :(

Hope you enjoy the new version and please report any issues you may find. I appreciate it.

tarunbatra commented 7 years ago

Great! Thanx for the swift action @cayasso !