9

node is crashing at the following line:

var tcp = require('tcp'),

error text:

node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: Cannot find module 'tcp'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (C:\Program Files\nodejs\websocket\websocket.js:11:11)

at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)

What is the problem? I found the source on the Internet, and the author, and the visitors also can run it...

2 Answers 2

12

Try require('net') instead:

$ node
> var tcp = require('tcp');
The 'tcp' module is now called 'net'. Otherwise it should have a similar interface.
> var tcp = require('net');
> $ 
Sign up to request clarification or add additional context in comments.

Comments

1

Others are able to run, may be because they are using Node module when 'tcp' was there...

Now its called 'net', but its all the same thing no need of checking..

If you want to cross check for your more information, here are the links:

1.http://nodejs.org/api/net.html

2.https://github.com/joyent/node/blob/master/lib/net.js

Comments

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.