NodeJS의 에러 코드를 보다보면, 축약어의 형태로 나오는 경우들이 있는데요.
오늘은 그것들은 한번 정리해보고자 합니다.

1. 자주 쓰이는 시스템 에러로그

EACCES (Permission denied)
An attempt was made to access a file in a way forbidden by its file access permissions.


EADDRINUSE (Address already in use)
An attempt to bind a server (net, http, or https) to a local address failed due to another server on the local system already occupying that address.

[ERR_UNESCAPED_CHARACTERS]

Request path contains unescaped characters

url의 query스트링에 텍스트가 들어가 있는 경우 이러한 에러를 보게 됩니다.

Javascript에는 이러한 경우를 위해서,

encodeURI()함수와  decodeURI()함수를 모두 가지고 있습니다.

텍스트가 들어간 url전체를 encodeURI함수를 이용한 return값을 넘겨주면 됩니다.

또는 NodeJS의 querystring.stringify를 이용해도 이를 해결할 수 있습니다.

 

 


ECONNREFUSED (Connection refused)
No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.

ECONNRESET (Connection reset by peer)
A connection was forcibly closed by a peer. This normally results from a loss of the connection on the remote socket due to a timeout or reboot. Commonly encountered via the http and net modules.



EEXIST (File exists)
An existing file was the target of an operation that required that the target not exist.


EISDIR (Is a directory)
An operation expected a file, but the given pathname was a directory.

EMFILE (Too many open files in system)
Maximum number of file descriptors allowable on the system has been reached, and requests for another descriptor cannot be fulfilled until at least one has been closed. This is encountered when opening many files at once in parallel, especially on systems (in particular, macOS) where there is a low file descriptor limit for processes. To remedy a low limit, run ulimit -n 2048 in the same shell that will run the Node.js process.


ENOENT (No such file or directory)
Commonly raised by fs operations to indicate that a component of the specified pathname does not exist -- no entity (file or directory) could be found by the given path.



ENOTDIR (Not a directory):
A component of the given pathname existed, but was not a directory as expected. Commonly raised by fs.readdir.



ENOTEMPTY (Directory not empty): 
A directory with entries was the target of an operation that requires an empty directory -- usually fs.unlink.



EPERM (Operation not permitted): 
An attempt was made to perform an operation that requires elevated privileges.


EPIPE (Broken pipe): 
A write on a pipe, socket, or FIFO for which there is no process to read the data. Commonly encountered at the net and http layers, indicative that the remote side of the stream being written to has been closed.



ETIMEDOUT (Operation timed out): 
A connect or send request failed because the connected party did not properly respond after a period of time. Usually encountered by http or net -- often a sign that a socket.end() was not properly called.



EAI_AGAIN (DNS lookup timed out error,): 
temporary failure in name resolution or simply the name server returned a temporary failure indication

인터넷 연결상태나 Proxy설정이 잘 되었는지 찾아보아야 함

실제로 이러한 문제가 있는 경우, 
아래와 같이 DNS Lookup툴을 돌려보면, DNS Timeout이 나오는 것을 볼 수 있습니다.

어떤 한국사이트 중에는, 외국에서 접근할 수 없도록 한 경우도 있는데요.
한국에서는 문제가 없던 것이,
외국Region의 서버에서 접근시에 이러한 에러를 보여주는 경우도 있습니다.







2. 기타 에러로그들


E2BIG

argument list too long



EADDRNOTAVAIL

address not available



EAFNOSUPPORT, "

address family not supported")                            \



EAGAIN

resource temporarily unavailable



EAI_ADDRFAMILY

address family not supported



EAI_AGAIN, "

temporary failure



EAI_BADFLAGS

bad ai_flags value



EAI_BADHINTS

invalid value for hints



EAI_CANCELED

request canceled



EAI_FAIL

permanent failure



EAI_FAMILY

ai_family not supported



EAI_MEMORY

out of memory



  XX(EAI_NODATA, "no address")                                                \

  XX(EAI_NONAME, "unknown node or service")                                   \

  XX(EAI_OVERFLOW, "argument buffer overflow")                                \

  XX(EAI_PROTOCOL, "resolved protocol is unknown")                            \

  XX(EAI_SERVICE, "service not available for socket type")                    \

  XX(EAI_SOCKTYPE, "socket type not supported")                               \

  XX(EAI_SYSTEM, "system error")                                              \

  XX(EALREADY, "connection already in progress")                              \

  XX(EBADF, "bad file descriptor")                                            \

  XX(EBUSY, "resource busy or locked")                                        \

  XX(ECANCELED, "operation canceled")                                         \

  XX(ECHARSET, "invalid Unicode character")                                   \

  XX(ECONNABORTED, "software caused connection abort")                        \

  XX(ECONNREFUSED, "connection refused")                                      \

  XX(ECONNRESET, "connection reset by peer")                                  \

  XX(EDESTADDRREQ, "destination address required")                            \

  XX(EEXIST, "file already exists")                                           \

  XX(EFAULT, "bad address in system call argument")                           \

  XX(EFBIG, "file too large")                                                 \

  XX(EHOSTUNREACH, "host is unreachable")                                     \

  XX(EINTR, "interrupted system call")                                        \

  XX(EINVAL, "invalid argument")                                              \

  XX(EIO, "i/o error")                                                        \

  XX(EISCONN, "socket is already connected")                                  \

  XX(EISDIR, "illegal operation on a directory")                              \

  XX(ELOOP, "too many symbolic links encountered")                            \

  XX(EMFILE, "too many open files")                                           \

  XX(EMSGSIZE, "message too long")                                            \

  XX(ENAMETOOLONG, "name too long")                                           \

  XX(ENETDOWN, "network is down")                                             \

  XX(ENETUNREACH, "network is unreachable")                                   \

  XX(ENFILE, "file table overflow")                                           \

  XX(ENOBUFS, "no buffer space available")                                    \

  XX(ENODEV, "no such device")                                                \

  XX(ENOENT, "no such file or directory")                                     \

  XX(ENOMEM, "not enough memory")                                             \

  XX(ENONET, "machine is not on the network")                                 \

  XX(ENOPROTOOPT, "protocol not available")                                   \

  XX(ENOSPC, "no space left on device")                                       \

  XX(ENOSYS, "function not implemented")                                      \

  XX(ENOTCONN, "socket is not connected")                                     \

  XX(ENOTDIR, "not a directory")                                              \

  XX(ENOTEMPTY, "directory not empty")                                        \

  XX(ENOTSOCK, "socket operation on non-socket")                              \

  XX(ENOTSUP, "operation not supported on socket")                            \

  XX(EPERM, "operation not permitted")                                        \

  XX(EPIPE, "broken pipe")                                                    \

  XX(EPROTO, "protocol error")                                                \

  XX(EPROTONOSUPPORT, "protocol not supported")                               \

  XX(EPROTOTYPE, "protocol wrong type for socket")                            \

  XX(ERANGE, "result too large")                                              \

  XX(EROFS, "read-only file system")                                          \

  XX(ESHUTDOWN, "cannot send after transport endpoint shutdown")              \

  XX(ESPIPE, "invalid seek")                                                  \

  XX(ESRCH, "no such process")                                                \

  XX(ETIMEDOUT, "connection timed out")                                       \

  XX(ETXTBSY, "text file is busy")                                            \

  XX(EXDEV, "cross-device link not permitted")                                \

  XX(UNKNOWN, "unknown error")                                                \

  XX(EOF, "end of file")                                                      \

  XX(ENXIO, "no such device or address")                                      \

  XX(EMLINK, "too many links")                                                \










































+ Recent posts