找不到模块(nodejs)
模块: getmac https://www.npmjs.org/package/getmac
Backstory:之前我使用过模块getmac,它的function就像一个魅力。 前段时间我更新了nodejs到0.11。 今天我试着再次使用它。 我安装它(NPM安装得到MAC)试图使用。 不。 “找不到模块”。 我在node_modules中看到getmac文件夹。 Npm ls
显示:
├─┬ getmac@1.0.6 │ └─┬ extract-opts@2.2.0 │ └── typechecker@2.0.8
我正在使用像20 +其他模块没有任何问题。
操作系统: Windows 7 32位,pipe理员帐户
我如何testing它是否工作:我的项目可能成为问题的可能性:
- 我创build了新的文件夹。
- 然后我打开命令行并使用:
npm install getmac
- 我用一行创build了
test.js
:require('getmac');
- 在命令行中:
nodejs test.js
-
每次结果都是一样的:
module.js:340 throw err; ^ Error: Cannot find module 'getmac' 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> (C:\Users\Nfq\testo\test.js:1:63) 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)
-
其他模块工作正常
我试过的:
- npm install getmac(没有发生错误)
- npm删除/卸载getmac并重新安装
- npm -g安装getmac
-
require('./node_modules/getmac')
- 从不同版本1.04 / 1.0.5 / 1.0.6的手动下载模块安装
- 节点0.11.13 / 0.10.32 / 0.10.25 / 0.8.27 /
- 将其安装在
program files/nodejs/node_modules
- 删除
%appdata%/npm/
- 删除
program files/nodejs/node_modules
- 重新启动电脑几次
- 在虚拟机上工作
- CLI
来自sublimetext2的错误:
[8036:1014/141615:INFO:CONSOLE(293)] "{"stack":"Error: Cannot find module 'getmac'\n at Function.Module._resolveFilename (module.js:334:15)\n "Uncaught Error: Cannot find module 'getmac'", source: module.js (336)
文件夹node_modules / getmac的文件结构:
C:\Users\Nfq\testo\node_modules\getmac - .npmignore - History.md - LICENSE.md - package.json - README.md - +¦¦¦bin - getmac-node - L¦¦¦node_modules L¦¦¦extract-opts - .npmignore - example.js - LICENSE.md - package.json - README.md - +¦¦¦node_modules - L¦¦¦typechecker - - .npmignore - - cyclic.js - - History.md - - LICENSE.md - - package.json - - README.md - - - L¦¦¦out - L¦¦¦lib - typechecker.js - L¦¦¦out L¦¦¦lib extract-opts.js
请帮帮我。
删除node_modules
文件夹,运行npm cache clean
然后重新安装npm install
软件包。