Verh
Verh

Reputation: 71

Cannot find module (nodejs)

Module: getmac https://www.npmjs.org/package/getmac

Backstory: I was using module getmac before and it worked like a charm. Some time ago I updated nodejs to 0.11. And today I tried to use it again. I installed it (npm install get mac) Tried it to use. Nope. "Cannot find module". I see getmac folder in node_modules. Npm ls shows:

├─┬ [email protected]
│ └─┬ [email protected]
│   └── [email protected]

I am using like 20+ other modules without any problems.

OS: Windows 7 32bit, administrator account

How I test if it work: Of possibility that my project can be the issue:

  1. I created new folder.
  2. Then I open command line and use: npm install getmac
  3. I created test.js with one line: require('getmac');
  4. In command line: nodejs test.js
  5. Every time result is the same:

    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)
    
  6. Others modules works fine

What I tried:

error from 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)

File structure of folder 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

Please help me.

Upvotes: 3

Views: 4507

Answers (1)

Razvan
Razvan

Reputation: 3152

Remove the node_modules folder, run npm cache clean then reinstall the packages npm install.

Upvotes: 4

Related Questions