danielgtaylor / nesh

An enhanced, extensible interactive shell for Node.js and CoffeeScript
http://danielgtaylor.github.io/nesh/
MIT License
288 stars 27 forks source link

Unable to require module inside eval file #44

Open lastcoolnameleft opened 8 years ago

lastcoolnameleft commented 8 years ago

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.<anonymous>: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