Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

nodejs throws: process.nextTick error, or 'error' event on first tick #1825

Closed
juneym opened this issue Oct 5, 2011 · 3 comments
Closed

Comments

@juneym
Copy link

juneym commented Oct 5, 2011

System Information:

Linux xxxxxxxxx 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64 GNU/Linu
CentOS Linux release 6.0 (Final)

run simple code

[root@xxxxxxxxx tmp]# cat test-server.js
node.http.createServer(function (req, res) {
  setTimeout(function () {
    res.sendHeader(200, {"Content-Type": "text/plain"});
    res.sendBody("Hello World");
    res.finish();
  }, 2000);
}).listen(8000);
puts("Server running at http://127.0.0.1:8000/");


[root@xxxxxxxxx tmp]# node test-server.js

node.js:207
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
ReferenceError: node is not defined
    at Object.<anonymous> (/root/tmp/test-server.js:1:63)
    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 Array.<anonymous> (module.js:470:10)
    at EventEmitter._tickCallback (node.js:199:26)

make test-simple

python tools/test.py simple
=== release test-net-pingpong ===
Path: simple/test-net-pingpong
server listening on /root/tmp/node/test/tmp/test.sock undefined
server listening on 20988 undefined
node.js:203
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: listen UNKNOWN
    at errnoException (net_uv.js:566:11)
    at Array.<anonymous> (net_uv.js:632:26)
    at EventEmitter._tickCallback (node.js:195:26)
Command: out/Release/node /root/tmp/node/test/simple/test-net-pingpong.js
=== release test-child-process-channel ===
Path: simple/test-child-process-channel
fds undefined
node.js:203
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Cannot read property 'length' of undefined
    at Object.<anonymous> (/root/tmp/node/test/simple/test-child-process-channel.js:14:20)
    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 Array.<anonymous> (module.js:470:10)
    at EventEmitter._tickCallback (node.js:195:26)

node.js:203
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
AssertionError: "undefined" == true
    at Object.<anonymous> (/root/tmp/node/test/fixtures/child-process-channel.js:4:8)
    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 Array.<anonymous> (module.js:470:10)
    at EventEmitter._tickCallback (node.js:195:26)
Command: out/Release/node /root/tmp/node/test/simple/test-child-process-channel.js
=== release test-child-process-spawn-node ===
Path: simple/test-child-process-spawn-node
node.js:203
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: undefined is not a function
    at Object.<anonymous> (/root/tmp/node/test/simple/test-child-process-spawn-node.js:5:9)
    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 Array.<anonymous> (module.js:470:10)
    at EventEmitter._tickCallback (node.js:195:26)
Command: out/Release/node /root/tmp/node/test/simple/test-child-process-spawn-node.js
=== release test-sendfd ===
Path: simple/test-sendfd
node.js:203
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Object #<Socket> has no method 'open'
    at Object.<anonymous> (/root/tmp/node/test/simple/test-sendfd.js:104:16)
    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 Array.<anonymous> (module.js:470:10)
    at EventEmitter._tickCallback (node.js:195:26)
Command: out/Release/node /root/tmp/node/test/simple/test-sendfd.js
=== release test-debugger-repl ===
Path: simple/test-debugger-repl
AssertionError: /break in .*:3/
Command: out/Release/node /root/tmp/node/test/simple/test-debugger-repl.js
=== release test-listen-fd ===
Path: simple/test-listen-fd
node.js:203
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Not implemented
    at Server.listenFD (net_uv.js:761:9)
    at Object.<anonymous> (/root/tmp/node/test/simple/test-listen-fd.js:47:5)
    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 Array.<anonymous> (module.js:470:10)
    at EventEmitter._tickCallback (node.js:195:26)
Command: out/Release/node /root/tmp/node/test/simple/test-listen-fd.js
=== release test-https-foafssl ===
Path: simple/test-https-foafssl
executing "curl --insecure https://127.0.0.1:12346/ --cert /root/tmp/node/test/fixtures/foafssl.crt --key /root/tmp/node/test/fixtures/foafssl.key"

/root/tmp/node/test/simple/test-https-foafssl.js:70
    if (err) throw err;
                   ^
Error: Command failed:
curl: (58) Unable to load client key -8178.

    at ChildProcess.exithandler (child_process_uv.js:149:15)
    at ChildProcess.emit (events.js:70:17)
    at maybeExit (child_process_uv.js:227:16)
    at Process.onexit (child_process_uv.js:262:5)
Command: out/Release/node /root/tmp/node/test/simple/test-https-foafssl.js
=== release test-child-process-custom-fds ===
Path: simple/test-child-process-custom-fds
Test 1...
child_process_uv.js:275
      throw new Error("customFds not yet supported");
            ^
Error: customFds not yet supported
    at setStreamOption (child_process_uv.js:275:13)
    at ChildProcess.spawn (child_process_uv.js:287:3)
    at child_process_uv.js:210:9
    at Object.oncomplete (/root/tmp/node/test/simple/test-child-process-custom-fds.js:47:17)
Command: out/Release/node /root/tmp/node/test/simple/test-child-process-custom-fds.js
=== release test-regress-GH-1697 ===
Path: simple/test-regress-GH-1697
Server running.
node.js:203
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: connect ECONNREFUSED
    at errnoException (net_uv.js:566:11)
    at Object.afterConnect [as oncomplete] (net_uv.js:557:18)
Command: out/Release/node /root/tmp/node/test/simple/test-regress-GH-1697.js
@OrangeDog
Copy link

Well for the first example, the error tells you exactly what's wrong. Why not look at some of the documented examples to see how you're supposed to use Node modules?

@juneym
Copy link
Author

juneym commented Oct 5, 2011

Thanks OrangeDog! I didn't noticed the missing require

The following works:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');

However, I am worried about the error when running "make test simple" .. to me they all look RED.

@koichik
Copy link

koichik commented Oct 6, 2011

Don't care, libuv backend is still under development.

@koichik koichik closed this as completed Oct 6, 2011
wiedi pushed a commit to wiedi/node that referenced this issue Aug 15, 2015
Notable changes:

* buffer:
  - Due to changes in V8, it has been necessary to reimplement Buffer
    on top of V8's Uint8Array. While every effort has been made to
    maintain performance, users are likely to experience a different
    performance profile depending on how Buffer is used.
    (Trevor Norris) nodejs#1825.
  - Buffer can now take ArrayBuffers as a constructor argument
    (Trevor Norris) nodejs#2002.
  - When a single buffer is passed to Buffer.concat(), a new, copied
    Buffer object will be returned; previous behavior was to return
    the original Buffer object (Sakthipriyan Vairamani) nodejs#1937.
* build: PPC support has been added to core to allow compiling on
  pLinux BE and LE (AIX support coming soon) (Michael Dawson) nodejs#2124.
* dgram: If an error occurs within socket.send() and a callback has
  been provided, the error is only passed as the first argument to the
  callback and not emitted on the socket object; previous behavior was
  to do both (Matteo Collina & Chris Dickinson) nodejs#1796
* freelist: Deprecate the undocumented freelist core module
  (Sakthipriyan Vairamani) nodejs#2176.
* http:
  - Status codes now all use the official IANA names as per RFC7231,
    e.g. http.STATUS_CODES[414] now returns 'URI Too Long' rather than
    'Request-URI Too Large' (jomo) nodejs#1470.
  - Calling .getName() on an HTTP agent no longer returns a trailing
    colon, HTTPS agents will no longer return an extra colon near the
    middle of the string (Brendan Ashworth) nodejs#1617.
* node:
  - NODE_MODULE_VERSION has been bumped to 45 to reflect the break in
    ABI (Rod Vagg) nodejs#2096.
  - Introduce a new process.release object that contains a name
    property set to 'io.js' and sourceUrl, headersUrl and libUrl
    (Windows only) properties containing URLs for the relevant
    resources; this is intended to be used by node-gyp
    (Rod Vagg) nodejs#2154.
  - The version of node-gyp bundled with io.js now downloads and uses
    a tarball of header files from iojs.org rather than the full
    source for compiling native add-ons; it is hoped this is a
    temporary floating patch and the change will be upstreamed to
    node-gyp soon (Rod Vagg) nodejs#2066.
* repl: Persistent history is now enabled by default. The history file
  is located at ~/.node_repl_history, which can be overridden by the
  new environment variable NODE_REPL_HISTORY. This deprecates the
  previous NODE_REPL_HISTORY_FILE variable. Additionally, the format
  of the file has been changed to plain text to better handle file
  corruption. (Jeremiah Senkpiel) nodejs#2224.
* smalloc: The smalloc module has been removed as it is no longer
  possible to provide the API due to changes in V8
  (Ben Noordhuis) nodejs#2022.
* tls: Add server.getTicketKeys() and server.setTicketKeys() methods
  for TLS session key rotation (Fedor Indutny) nodejs#2227.
* v8: Upgraded to 4.4.63.26
  - ES6: Enabled computed property names
  - ES6: Array can now be subclassed in strict mode
  - ES6: Implement rest parameters in staging, use the
    --harmony-rest-parameters command line flag
  - ES6: Implement the spread operator in staging, use the
    --harmony-spreadcalls command line flag
  - Removed SetIndexedPropertiesToExternalArrayData and related APIs,
    forcing a shift to Buffer to be reimplemented based on Uint8Array
  - Introduction of Maybe and MaybeLocal C++ API for objects which may
    or may not have a value.
  - Added support for PPC

PR-URL: nodejs/node#2299
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants