How hostname-patcher works? #1
-
hello sir i don't understand about this solution, i also have the same error |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
ExplainationThis is an error caused by Node.js retrieving "OS Hostname" (the name of the Operating System) whose function Line 11 in 38a01ef Why this worksAlso if os module is required another time into another file this continue to work because modifying hostname function from the os module will make sure the new require will keep the patched function instead of the broken one. Should you be worried?No, this is completely safe, because any change to os module will be lost after script runtime end. Does it break working Node.js machines?No it doesn't, because this patch checks if |
Beta Was this translation helpful? Give feedback.
Explaination
This is an error caused by Node.js retrieving "OS Hostname" (the name of the Operating System) whose function
os.hostname()
seems not to be implemented (broken) in Windows 7 devices using a not officially Node.js supported version (14 and above): the code just "implements" it by returning "localhost" every function call.hostname-patcher/lib/index.js
Line 11 in 38a01ef
Why this works
Also if os module is required another time into another file this continue to work because modifying hostname function from the os module will make sure the new require will keep the patched function instead of the broken one.
Should you be worried?