danielgtaylor / danielgtaylor/nesh

Unable to require module inside eval file

Open
#44 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
284
Forks
23
PR merge metrics
No merged PRs in 30d

Description

If I try nesh.js as:

```
.require nconf
```

I get:

```
[tfalgout@beyondinto-lm necs]$ nesh -b --eval nesh.js
Babel 5.8.38 on Node v5.2.0
Type .help for more information
babel> Error in plugin eval:
SyntaxError: Unexpected token .
at Object.exports.runInThisContext (vm.js:54:16)
at exports.postStart (/usr/local/lib/node_modules/nesh/lib/plugins/eval.js:24:19)
at callPluginMethod (/usr/local/lib/node_modules/nesh/lib/nesh.js:73:9)
at process (/usr/local/lib/node_modules/nesh/lib/nesh.js:40:16)
at /usr/local/lib/node_modules/nesh/lib/nesh.js:52:18
at callPluginMethod (/usr/local/lib/node_modules/nesh/lib/nesh.js:78:14)
at process (/usr/local/lib/node_modules/nesh/lib/nesh.js:40:16)
at process (/usr/local/lib/node_modules/nesh/lib/nesh.js:55:16)
at processPlugins (/usr/local/lib/node_modules/nesh/lib/nesh.js:58:12)
at /usr/local/lib/node_modules/nesh/lib/nesh.js:105:14
undefined
babel>
```

If I try:

```
const nconf = require('nconf');
```

I get:

```
[tfalgout@beyondinto-lm necs]$ nesh -b --eval nesh.js
Babel 5.8.38 on Node v5.2.0
Type .help for more information
babel> Error in plugin eval:
Error: Cannot find module 'nconf'
at Function.Module._resolveFilename (module.js:327:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at evalmachine.:1:15
at Object.exports.runInThisContext (vm.js:55:17)
at exports.postStart (/usr/local/lib/node_modules/nesh/lib/plugins/eval.js:24:19)
at callPluginMethod (/usr/local/lib/node_modules/nesh/lib/nesh.js:73:9)
at process (/usr/local/lib/node_modules/nesh/lib/nesh.js:40:16)
at /usr/local/lib/node_modules/nesh/lib/nesh.js:52:18
undefined
.exit
```

Is there something I'm missing?

Proof that I do have the nconf module:

```
[tfalgout@beyondinto-lm necs]$ nesh -b
Babel 5.8.38 on Node v5.2.0
Type .help for more information
babel> .require nconf
nconf = require("nconf")
nconf = require("./nconf")
babel> nconf
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.