我收到了这个令人讨厌的错误(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)
...
...所以我想,也许我可以在这个console.log
中添加几个module.js
,从而跟踪考虑加载的文件/路径。
但是,我似乎无法在任何地方找到module.js
:
$ find ~/.nvm/ -name 'module.js' # nothing
$ find /path/to/slimerjs-0.10.1-pre -name module.js # nothing
然后我转到https://github.com/nodejs/node/search?utf8=%E2%9C%93&q=module.js - 我得到了大量的点击,而不是文件module.js
:/
我在哪里可以找到此文件?它是否以某种方式在node
内编译,因为我似乎无法单独找到它?
答案 0 :(得分:4)
Here it is.广泛记录here。
是的,它是Node.js内部的一部分,因此除非您想从源代码构建,否则无法对其进行修改。
你可以做的是attach a debugger,以追踪它正在做的事情。
为了将来参考,您使用的是代码搜索this is the file search。