__dirname has two underscores in the beginning, not one.
On Fri, Aug 24, 2012 at 9:46 PM, MikeB_2012 <[email protected]> wrote:
> To test an error appearing in a larger script, I made a very short script
> called 'a.js' which contains one line: console.log(_dirname); . I expected
> to get the directory name but got an error instead (below). I have node
> installed on a usb drive plugged in to a Win7 machine.
>
>
> K:\nodejs>node_x64 --version
> v0.8.8
>
> K:\nodejs>node_x64 a.js
>
> K:\nodejs\a.js:1
> ion (exports, require, module, __filename, __dirname) {
> console.log(_dirname);
> ^
> ReferenceError: _dirname is not defined
> at Object.<anonymous> (K:\nodejs\a.js:1:75)
> at Module._compile (module.js:449:26)
> at Object.Module._extensions..js (module.js:467:10)
> at Module.load (module.js:356:32)
> at Function.Module._load (module.js:312:12)
> at Module.runMain (module.js:492:10)
> at process.startup.processNextTick.process._tickCallback
> (node.js:244:9)
>
> K:\nodejs>
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en