md5
在我设置的 Ubuntu 开发服务器上正确安装节点模块时遇到了一些问题。
(它在我的本地 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 识别为已安装?
谢谢,