I finally found where the question arose. It is not Jade or Express, it is Uglify-JS , which is a transformers dependency, which is a jade dependency, which is often an expression dependency.
I ran into this problem in JetBrains WebStorm IDE on Windows 7 and Windows 8 (both 64-bit).
I already went and fixed the problem in this transfer request .
All I had to do was include the process in the node vm context object. After that, I got a new error:
[ReferenceError: buffer not defined]
All I needed to do was to include a Buffer in the vm context object, and I no longer receive these stupid messages.
I still don't quite understand why this happens only during debugging, but in my extremely limited experience I came to the conclusion that node vm module is a fickle thing, or at least the way some people use it.
Edit: This is a bug in the node vm module . I figured out how to play it, and I understood why this only happens during debugging.
This error occurs only if you include the third (file) argument in vm.runInContext(code, context, file); . All documentation speaks of this argument that it is optional and is used only in the stack trace. From the very beginning, you can understand why this only happens during debugging. However, when you pass this argument, some kind of ridiculous behavior starts to happen.
To reproduce the error (note that the file argument must be sent or this error never occurs at all):
The file argument must end with ".js" and must contain at least one forward slash or double backslash. Since this argument is expected to be a file path, it makes sense that having these functions might cause some other functions.
The code you pass in (first argument) should not start with a function. If it starts with a function, an error does not occur. It still seems that the beginning of the code with anything other than a function will generate a reference error. Do not ask me why this argument has any effect on whether or not an error appears because I have no idea.
You can fix the error by including process in the context object that you pass to vm.createContext(contextObject); .
var context = vm.createContext({ console: console, process: process });
If your file path argument is well-formed (meets the requirements in # 1), then the inclusion of process in the context will get rid of the error message; that is, if your file path does not point to the actual file, in this case you will see the following:
{ [Error: ENOENT, no such file or directory 'c:\suatils.js'] errno: 34, code: 'ENOENT', path: 'c:\\test.js', syscall: 'open' }
Pointing to the actual file will get rid of this error.
I'm going to expand the node repository and see if I can improve this feature and how it behaves, then maybe I will send a transfer request. At least I will open a ticket for the node command.
Edit 2: I decided this was a problem with WebStorm specifically. When WebStorm starts the node process, we get this problem. If you are debugging from the command line, there is no problem.
Video: http://youtu.be/WkL9a-TVHNY?hd=1