I am working on finding node.js and I am playing with the imap and mailparser code sample found here . I installed imap and mailparser according to the instructions in the readme docs found on their respective github pages, and everything installed perfectly without any errors. When I try to run the sample code, I get the following error:
Error: Cannot find module 'iconv'
After installing the modules, the structure of my project is as follows:
~/ProjectDir | -- node_modules | | | -- imap | | | | | -- LICENSE | | -- README.md | | -- imap.js | | -- package.json | -- mailparser | | | | | -- lib | | | | | | | -- datetime.js | | | -- mailparser.js | | | -- streams.js | | -- node_modules | | | | | | | -- iconv | | | | ... | | | -- mimelib | | | | ... | | -- test | | | ... | | -- LICENSE | | -- README.md | | -- package.json | | ... | -- config.json | -- mailFether.js | -- readme.md
So, based on some errors that I made for this problem, I noticed that this โCannot find the moduleโ error seems to be quite common, but I was able to see a consistent solution to the problem.
Is the problem here a nested node_modules
directory in the mailparser
folder? Should the contents of this folder be in the node_modules
folder in the root of the project? Is this a project installation problem or an environmental problem?
source share