1

I got this nasty error (slimerjs Can not resolve required module encoding):

Error: Cannot find module 'encoding'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
...

... so I thought, maybe I could add a couple of console.log in this module.js, and thereby trace what files/paths are considered for loading.

However, I cannot seem to find this module.js anywhere:

$ find ~/.nvm/ -name 'module.js'  # nothing
$ find /path/to/slimerjs-0.10.1-pre -name module.js  # nothing

Then I go to https://github.com/nodejs/node/search?utf8=%E2%9C%93&q=module.js - and I get a whole lot of hits, just not the file module.js :/

Where can I find this file? Also, is it somehow compiled inside node, as I cannot seem to find it standalone?

Community
  • 1
  • 1
sdbbs
  • 4,270
  • 5
  • 32
  • 87

1 Answers1

4

Here it is. It's documented extensively here.

Yes, it's part of Node.js internals so you cannot modify it unless you want to build from source.

What you can do though is attach a debugger in order to trace what it's doing.

For future reference you were using the code search, this is the file search.

OrangeDog
  • 36,653
  • 12
  • 122
  • 207