Nodejs模块没有find错误

大家好我是非常新的nodejs。 我正在尝试通过使用以下命令来安装cryptlib模块:

npm install cryptlib 

它成功安装。 当我移动到myproject ->node_modules ,名为myproject ->node_modules的文件夹就在那里。

但是,当我把它包括在我的server.js如下

 var CryptLib = require('cryptlib'), _crypt = new CryptLib(), plainText = 'This is the text to be encrypted', iv = _crypt.generateRandomIV(16), //16 bytes = 128 bit key = _crypt.getHashSha256('my secret key', 32), //32 bytes = 256 bits cypherText = _crypt.encrypt(plainText, key, iv), originalText = _crypt.decrypt(cypherText, key, iv); 

然后它抛出一个错误

 module.js:340 throw err; ^ Error: Cannot find module 'cryptlib' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/var/www/html/testing/server.js:9:16) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) 

那么我该如何解决这个错误呢? 任何帮助将appriciated。

这似乎是原包装的问题。 我发送了一个拉请求来解决这个问题。 现在,只要做我所做的拉请求,它应该工作。

对不起,我没有足够的积分来回应评论之前。

我已经更新了npm上的cryptlib到版本1.0.3来解决这个问题。 它应该现在工作。 谢谢王庭茂的出色工作。

也感谢您使用该模块user3446467。

如果您遇到任何其他问题,请告诉我。