Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6625627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:47:48+00:00 2026-05-25T21:47:48+00:00

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

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:47:49+00:00Added an answer on May 25, 2026 at 9:47 pm

    I am pretty sure that watchFile is not yet supported on windows:

    https://github.com/joyent/node/issues/1358

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying this code: var connect = require(connect); var io = require(socket.io); var spawn
I'm trying to add a new node to an jQuery SimpleTree , but all
My code doesn't return the node XmlDocument xml = new XmlDocument(); xml.InnerXml = text;
I'm quite new to node and am trying to create something that gets some
I receive this error when trying to run a node.js server. I recently migrated
Im new to the XSLT world, I am basically trying to run the JSON
I'm trying to run the ruby gem mongo3 (http://mongo3.com/) I'm new to gem, but
I'm trying to build a simple web application using Node.js and CouchDb. The application
I am messing around in Node.js trying to replicate that simple chat server that
I have a function that inserts a new node at the tail end of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.