我在设置好的Ubuntu开发服务器上安装md5
节点模块时遇到了一些问题。
(在我的本地Windows机器上正常工作,并且我可以在开发服务器上使用npm安装其他模块)
当我尝试启动正在开发的NodeJS应用程序时,它会失败并指出md5
模块未安装。
// trying to start my application that depends on md5.
drichardson@devwebserver:/var/www/node_app/meanapp$ node server.js
module.js:340
throw err;
^
Error: Cannot find module 'md5'
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/node_app/node_modules/hashfile/index.js:7:11)
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/var/www/node_app/meanapp/app/controllers/exchanges.server.controller.js:15:14)
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)
我尝试将其安装在我的工作目录中:
// Installing in working directory
drichardson@devwebserver:/var/www/node_app/meanapp$ sudo npm install --save md5
npm http GET https://registry.npmjs.org/md5
npm http GET https://registry.npmjs.org/md5
npm http 304 https://registry.npmjs.org/md5
npm http GET https://registry.npmjs.org/is-buffer
npm http GET https://registry.npmjs.org/crypt
npm http GET https://registry.npmjs.org/charenc
npm http 304 https://registry.npmjs.org/crypt
npm http GET https://registry.npmjs.org/is-buffer
npm http GET https://registry.npmjs.org/charenc
npm http 200 https://registry.npmjs.org/is-buffer
npm http GET https://registry.npmjs.org/is-buffer/-/is-buffer-1.0.2.tgz
npm http GET https://registry.npmjs.org/is-buffer/-/is-buffer-1.0.2.tgz
npm http GET https://registry.npmjs.org/charenc
npm http GET https://registry.npmjs.org/charenc/-/charenc-0.0.1.tgz
npm http 200 https://registry.npmjs.org/charenc/-/charenc-0.0.1.tgz
npm http GET https://registry.npmjs.org/is-buffer/-/is-buffer-1.0.2.tgz
npm http 200 https://registry.npmjs.org/is-buffer/-/is-buffer-1.0.2.tgz
md5@2.0.0 node_modules/md5
├── charenc@0.0.1
├── crypt@0.0.1
└── is-buffer@1.0.2
尽管节点模块显示在我的/node_modules文件夹中,它仍会抛出“找不到模块
md5
”的错误消息。 // MD5 In my node_modules folder:
drichardson@devwebserver:/var/www/node_app/meanapp/node_modules$ ls -la | grep 'md5'
drwxr-xr-x 2 drichardson drichardson 4096 Oct 30 13:53 md5
我还尝试过以下方法:
- 使用“npm install -g md5”全局安装模块
- 清除缓存并重新安装“npm cache clean”
- 使用“npm install”重新安装应用程序
还有什么其他办法可以让npm识别已安装的md5模块吗?
谢谢。