Nodejs error: Cannot find module ‘iconv-lite’

  node.js, question

Nodejs error: Cannot find module ‘iconv-lite’

Nodejs Version: Wenchuan earthquake on May 12
Statement:var iconv = require("iconv-lite");
It is correct to execute the statement directly in node.

However, put this statement iniconv_test.jsThis is the only sentence in the document.
reoccupynodeTo runiconv_test.jsThe file will go wrong.
What is going on here?


Thank@krewReminder, I put the folder containing iconv-lite packagenode_modulesAfter copying to the same directory of js program files, the problem is solved!

Nodejs’s package management mechanism is really wonderful. If you write a program like this, you have to copy the required package once, which will not make the disk inside full of node packages ~