CImrie / mongomem

In-memory MongoDB Server. Ideal for testing.
58 stars 7 forks source link

Error: Cannot find module 'babel-runtime/regenerator' #8

Closed omonk closed 5 years ago

omonk commented 5 years ago

I'm trying this module out to use with Ava, I've taken the example code (switched esm to requireJS) but im unable to get it running.

const test = require('ava');
const MongoDBServer = require('mongomem');

test.before('start server', async t => {
  await MongoDBServer.start();
});

test('some feature', async t => {
  const connectionString = await MongoDBServer.getConnectionString();
  console.log(connectionString);

  // connectionString === 'mongodb://localhost:27017/3411fd12-b5d6-4860-854c-5bbdb011cb93'
  // Use `connectionString` to connect to the database with a client of your choice. See below for usage with Mongoose.
});

returns

  Uncaught exception in src/parse-env-var.test.js

  /Users/me/sites/projectName/node_modules/mongomem/build/MongoDBServer.js:7

  Error: Cannot find module 'babel-runtime/regenerator'

I've tried on several versions of node (8.9.0 10.14.0 and 11.3.0) but unable to get anything working. Fresh node_module installs with rm -rf package-lock.json to be safe as well

CImrie commented 5 years ago

Hi @omonk ,

I've re-cloned the project from fresh and it's working for me. Have you tried installing babel-runtime/regenerator as it seems to suggest? It's possible this is project-specific.

Failing that, can you provide a repository that I can clone that reproduces the error? I'm not sure how best to support requireJS format (if it can be done) but certainly willing to take a look.

adrienjoly commented 5 years ago

npm i babel-runtime --save-dev worked for me.

That said, can we integrate that dependency in mongomem's package.json, so that we don't have to do that step manually?