Node.js watchFile error. "Undefined is not a function"

I am new to Node.js and I am trying to run simple Node.js code.

I have Node.js windows binary.v0.5.8

here is my js code.

var fs = require("fs"); fs.readFile('message.text', 'utf8', function (err,data) { if (err) { return console.log(err); } console.log(data); }); fs.watchFile('message.text',function (curr, prev) { console.log('the current mtime is: ' + curr.mtime); console.log('the previous mtime was: ' + prev.mtime); });

When I keep only the readFile in the code it runs smoothly. But gives following error on watchfile.

C:\Users\GG\Labs\NodeJS>node.exe test.js node.js:208 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: undefined is not a function at new StatWatcher (fs.js:596:18) at Object.watchFile (fs.js:648:37) at Object.<anonymous> (C:\Users\GG\Labs\NodeJS\test.js:25:4) at Module._compile (module.js:425:26) at Object..js (module.js:443:10) at Module.load (module.js:344:31) at Function._load (module.js:303:12) at Array.<anonymous> (module.js:463:10) at EventEmitter._tickCallback (node.js:200:26)

Any idea????

-------------Problems Reply------------

Hej GG

Hej i am pretty shore that watchFile is not yet supported on windows

Category:javascript Views:0 Time:2011-10-01

Related post

  • uncaught type error: undefined is not a function 2014-08-05

    Im making a simple form with Telerik Appbuilder HTML5 + javascript that takes a users input and logs it to the console when they click the submit button. ClientClass.js: function Client() { this.username = "username", this.password = "Password", this

  • Error: "undefined is not a function" backbone.js 2012-01-31

    Can anyone tell me why this code would throw an "undefined is not a function" error at var myview = new view();? I've been looking all over and I'm pretty sure everything's right. router = Backbone.Router.extend({ routes: { '/': 'project' }, project:

  • Defined method in my jQuery plugin return's the error : undefined is not a function? 2014-05-17

    I have the following code, and I am getting the error Uncaught TypeError: undefined is not a function (repeated 8 times) for the method _setProgress() that it is defined. My plugin code is the following: ;( function($, window, document, undefined) {

  • Weird JavaScript error: undefined is not a function 2014-06-17

    I'm having trouble debugging my chrome extension.. The debugger says "Error in response to tabs.query: TypeError: undefined is not a function". My code is the following: chrome.pageAction.onClicked.addListener (function (tab) { chrome.tabs.query ({ac

  • JQuery error undefined is not a function 2015-01-11

    I am using a small piece of javascript in one of my components. On my development server it is working properly but when I put it online it gives me the error: Uncaught TypeError: undefined is not a function This error comes for the first line: jQuer

  • C++ Compilation error: Undefined identifier (for a function parameter) 2012-01-29

    I have a C++ class main.cpp in which I created a class like following: class MapSearchNode { public: unsigned int x; // the (x,y) positions of the node unsigned int y; MapSearchNode() { x = y = 0; } MapSearchNode( unsigned int px, unsigned int py ) {

  • What causes the error "undefined reference to (some function)"? 2011-11-06

    This question already has an answer here: What is an undefined reference/unresolved external symbol error and how do I fix it? 17 answers I get the error: main.o(.text+0x1ed): In function `main': : undefined reference to `avergecolumns' collect2: ld

  • Resolving a linker error: undefined reference to static class members 2011-04-09

    My code is Arduinoish. I turned on verbose compiling so I could verify that all the .o files are indeed getting passed to the linker correctly, and they are (linker command below). This leads me to believe that it is some sort of syntax error. Googli

  • Google Charts API: new google.visualization.Table() - Uncaught TypeError: undefined is not a function 2011-08-05

    I have copied the Google Code example into a php script however I am getting the error "undefined is not a function" it is happening specifically on this line: var table = new google.visualization.Table(document.getElementById('table_sort_div')); It

  • 'undefined' is not a function (evaluating '$("#map").goMap') 2012-02-14

    I realized a map with the plugin goMap(). Therefore I wrote this function: $(function() { $("#map").goMap({ ... What can I do to prevent this Type Error: 'undefined' is not a function (evaluating '$("#map").goMap') at all other sides, which hasn't a

  • Undefined is not a function in Backbone.js 2012-03-03

    I get the error "undefined is not a function" when running this code locally and from a Dropbox public url, However, when I run it on jsfiddle it works as expected: In short, I

  • Breeze getProperty "undefined is not a function" with 1.14.12 stack (EF6) 2014-05-26

    I am receiving the following error: "undefined is not a function at updateRelatedEntityInCollection (localhost:3091/scripts/breeze.debug.js:14542:40" when using the breeze stack 1.14.12 with EF 6.1 / WebApi2. I have the following entities / maps defi

  • jQuery Tabs "Undefined is Not a Function" 2014-07-28

    I've recently been trying to use or familiarize myself with the JQuery tabs function. However everytime I've tried using it I get the error "undefined is not a function". I've researched this problem and a lot say it may have to do with the .js file

  • Magento javascript undefined is not a function jquery selectric? 2014-08-05

    I am having a problem on my site trying to add a few dropdown menus to the header! I am using Magento CE 1.8.0 with Airhotels module. The weird thing is on some pages it works and on some it doesnt. It seems to me that pages related directly to Airho

  • Tablesorters addparse gives "undefined is not a function " 2014-09-23

    Tablesorter isn't acception .addParser somehow. I get the error "undefined is not a function". This is my code: $('mytable').tablesorter({ sortList: [[0,0]], sortRestart: true, initialized: function(table) { var currentTable = $(table); var startcol

  • Exception error: undefined function in Mochiweb/Erlang 2009-06-11

    After seeing this article, I have been tinkering with mochiweb. While trying to replicate what's done in the article - basically setting up a mochiweb server, having two erlang nodes, and then calling a function defined in one node in the other (afte

  • Node.js TypeError: undefined is not a function 2012-05-02

    I'm trying to call this function on my model User(I'm using mongoose). like this: UserSchema.statics.exists = function exists(req,email, callback) { this.findOne({ email : email }, function(err, user,callback) { if(err) { console.error(err); return c

  • jQuery .getJSON Firefox 3 Syntax Error Undefined 2008-12-02

    I'm getting a syntax error (undefined line 1 test.js) in Firefox 3 when I run this code. The alert works properly (it displays 'work') but I have no idea why I am receiving the syntax error. jQuery code: $.getJSON("json/test.js", function(data) { ale

  • Linux c++ error: undefined reference to 'dlopen' 2009-06-05

    I work in Linux with c++ (eclipse) and want to use a library. Eclipse shows me an error: undefined reference to 'dlopen' Do you know a solution? Here is my code. #include <stdlib.h> #include <stdio.h> #include <dlfcn.h> int main(int

Copyright (C), All Rights Reserved.

processed in 0.141 (s). 11 q(s)