2

i know that node.js is relativity new.. so i hope that someone here can really help me.

i want to make a simple server-client program that works on windows 7.

i am having some problem in creating a file module.

i have one file lets call it a.js

/* a.js file*/
var net = require('net');
function startServer(port,resourceMap,rootFolder){
//does somthing
}

exports.startServer=startServer;

and then another file b.js in the same folder

/* b.js file*/
var server = require('*.*\a');

for some reason when i try to run the command node b.js it tells me that it does not recognize the module.

i know that in linux

var server = require('./a');

should work. but i searched allot and all the examples that i find are only linux.

i know that it is probably smothing stupid, but i cant seem to find it.

thank you

3
  • 1
    Are you talking about Node.js? Jnode seems to be something different entirely. If you are, in Node.js, var a = require('./a'); etc. should work regardless of platform. Commented Dec 6, 2011 at 0:43
  • you are right. i got mixed up...it is node.js the compiler claims that a is not defined. don't know why.. Commented Dec 6, 2011 at 0:47
  • What output do you see on the terminal? Commented Dec 6, 2011 at 2:05

1 Answer 1

1

I don't know what you think that this code block is supposed to do:

var server = require('*.*\a');

Node.js normalizes disk paths between Linux and Windows so using var server = require('./a'); will work just fine on Windows.

Sign up to request clarification or add additional context in comments.

1 Comment

well.. for some reason the compiler just does not recognize it. it tells me that a is not defined. maybe it is the node version that i downloaded? 0.6.3.0?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.