nodejs - TypeError:undefined不是函数

时间:2015-11-29 17:35:28

标签: javascript node.js

我正在尝试从服务器重定向并根据切换结果显示网页,但我收到了下一个错误:

while True:
    message = input("q to quit\n"  # use implicit string joining
                    "w to walk randomly for 1000 steps\n"
                    "e to erase screen and walk randomly\n"
                    "> ")[:1].lower()  # forgive non-exact input
    if message == "q":
        print("Have a nice day!")
        break
    elif message =="w": 
        randomrun()
        jumpto(x,y)
    elif message == "e":
        t.clear()
        randomrun()
        jumpto(x,y)
    else:
        print("Input not recognized; try again.")

任何人都可以帮助我吗?提前致谢。 CGA

我的server.js代码

TypeError: undefined is not a function
at Server.emit (events.js:110:17)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:491:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:111:23)
    at Socket.socketOnData (_http_server.js:343:22)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)

1 个答案:

答案 0 :(得分:0)

fs.readfile应为fs.readFile