Question: We are trying to run rbenv on El-Capitan 10.11.6. When we try to run rbenv command in the terminal we got the following error message:

```
command not found

```

We googled how to solve that issue and one possible solution is to add the "rbenv" to the system PATH, we followed the steps stated in [this link](http://architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/#.WUvUPUX5yL9). When we run the "$PATH" to check whether or not the rbenv path was added properly into the system PATH, we got the the same result:

```
command not found

```

The result of "$PATH" command is:

```
qwe-Mac-mini:~ amrbakri$ rbenv

-bash: rbenv: command not found
qwe-Mac-mini:~ asd$ echo $PATH    

/Users/asd/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin

```

Can you please tell me how to add the path of rbenv properly? And what did I do wrong in the previous steps so that I can fix it.

Answer: 
Assuming your source is stored in `exampleScriptFile`:

```js
// polyfill
const fs = { readFileSync() { return 'console.log(`${EXAMPLE_3}`);'; } };

// CONSTANTS
const EXAMPLE_1 = 'EXAMPLE_1';
const EXAMPLE_2 = 'EXAMPLE_2';
const EXAMPLE_3 = 'EXAMPLE_3';

const exampleScriptFile = fs.readFileSync('./exampleScriptFile.js');

// What I want is to just use a JS file because it is neater.
eval(exampleScriptFile);
```

### Update

Perhaps I wasn't clear. The `./exampleScriptFile.js` should be:

```
console.log(`${EXAMPLE_3}`);

```
While what you're describing can be done with `eval` as @PatrickRoberts demonstrates, that doesn't extend to `executeJavaScript`.

The former runs in the caller's context, while the latter triggers an IPC call to another process with the contents of the code. Presumably this process doesn't have any information on the caller's context, and therefore, the template strings can't be populated with variables defined in this context.

### Relevant snippets from [electron/lib/browsers/api/web-contents.js](https://github.com/electron/electron/blob/3abeb6e2bc5a300d9cc787b893584922f1e39e06/lib/browser/api/web-contents.js#L148):

```
WebContents.prototype.send = function (channel, ...args) {
  // ...
  return this._send(false, channel, args)
}

// ...

WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callback) {
  // ...
  return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript',
  // ...
}

// ...

const asyncWebFrameMethods = function (requestId, method, callback, ...args) {
  return new Promise((resolve, reject) => {
    this.send('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args)
    // ...
  })
}

```

### Relevant snippets from [electron/atom/browser/api/atom\_api\_web\_contents.cc](https://github.com/electron/electron/blob/3abeb6e2bc5a300d9cc787b893584922f1e39e06/atom/browser/api/atom_api_web_contents.cc)

```
//...
void WebContents::BuildPrototype(v8::Isolate* isolate,
                                 v8::Local<v8::FunctionTemplate> prototype) {
  prototype->SetClassName(mate::StringToV8(isolate, "WebContents"));
  mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
      // ...
      .SetMethod("_send", &WebContents::SendIPCMessage)
      // ...
}

```