Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMError: Access denied to require 'module', mongoose #30

Closed
mStirner opened this issue Apr 6, 2016 · 1 comment
Closed

VMError: Access denied to require 'module', mongoose #30

mStirner opened this issue Apr 6, 2016 · 1 comment

Comments

@mStirner
Copy link

mStirner commented Apr 6, 2016

I will use your VM module to make my code more modular.

When i youse mongoose inside the VM i got a "Access Denied" error:
VMError: Access denied to require 'module'

    // read source from module
    var module = that.modules[key];
    var source = fs.readFileSync(module.path, "utf8");

    // vm options
    var options = {
      console: 'inherit',
      sandbox: {
        log: module.log
      },
      require: true,
      requireExternal: true,
      //requireNative: "",
      requireRoot: "./",
      useStrict: false

    };

    // create vm & run
    var vm = new NodeVM(options);
    var moduleEntry = vm.run(source, module.path);

    moduleEntry(that.injector);

  });
patriksimek added a commit that referenced this issue Apr 6, 2016
@patriksimek
Copy link
Owner

Fixed in 2.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants