Node.js无法找到模块'tcp'
16lz
2021-01-22
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 个解决方案
#1
12
Try require('net')
instead:
请尝试require('net'):
$ node
> var tcp = require('tcp');
The 'tcp' module is now called 'net'. Otherwise it should have a similar interface.
> var tcp = require('net');
> $
更多相关文章
- 读取python中的unicode文件,该文件以与python源代码相同的方式声
- 迭代地在python中编写XML节点
- django npm和节点包体系结构
- 软交换FreeSWITCH系统概要和源代码分析预备知识
- Linux内核源代码情景分析读书笔记(5)-关于fork/clone/vfork
- Linux下各类TCP网络服务器的实现源代码
- U-Boot启动过程源代码分析(2)-第二阶段
- 如何查看linux命令源代码和函数源代码
- UNIX网络编程之源代码的编译和使用