Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module 'nan' #19

Open
ktiedt opened this issue Jan 31, 2018 · 6 comments
Open

Cannot find module 'nan' #19

ktiedt opened this issue Jan 31, 2018 · 6 comments

Comments

@ktiedt
Copy link

ktiedt commented Jan 31, 2018

npm install nan fixes this, but seems like it should be unnecessary?

$ npm install node-mac-notifier
npm WARN deprecated [email protected]: Use uuid module instead

> [email protected] install /Users/karl.tiedt/Projects/polymer-2-electron-example/node_modules/node-mac-notifier
> node-gyp rebuild

module.js:540
    throw err;
    ^

Error: Cannot find module 'nan'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at [eval]:1:1
    at ContextifyScript.Script.runInThisContext (vm.js:50:33)
    at Object.runInThisContext (vm.js:139:38)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:643:30)
    at evalScript (bootstrap_node.js:462:27)
gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/karl.tiedt/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/Users/karl.tiedt/.nvm/versions/node/v8.9.4/bin/node" "/Users/karl.tiedt/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/karl.tiedt/Projects/polymer-2-electron-example/node_modules/node-mac-notifier
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
@shakogegia
Copy link

same to me :(

@CharlieHess
Copy link
Owner

Yeah, I'm keeping both nan and node-gyp as devDependencies.

@vassudanagunta
Copy link

@CharlieHess

Yeah, I'm keeping both nan and node-gyp as devDependencies.

Why? It creates headaches for your users. Aren't you just defeating the purpose of the dependency mechanism?

  • I added const notifier = require('node-mac-notifier'); resulted in the above error, as my IDE automatically runs npm install for missing modules.
  • I ran npm install node-mac-notifier exactly as your README says, and I get
> [email protected] install /Users/vas/Repos/projects/corner-pocket/node_modules/node-mac-notifier
> node-gyp rebuild

internal/modules/cjs/loader.js:651
    throw err;
    ^

Error: Cannot find module 'nan'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)
    at Function.Module._load (internal/modules/cjs/loader.js:575:25)
    at Module.require (internal/modules/cjs/loader.js:705:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at [eval]:1:1
    at Script.runInThisContext (vm.js:124:20)
    at Object.runInThisContext (vm.js:314:38)
    at Object.<anonymous> ([eval]-wrapper:9:26)
    at Module._compile (internal/modules/cjs/loader.js:799:30)
    at evalScript (internal/process/execution.js:60:25)
gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node/11.12.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/vas/Repos/projects/corner-pocket/node_modules/node-mac-notifier
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vas/.npm/_logs/2019-04-02T21_44_32_708Z-debug.log

@abettadapur
Copy link

Agreed, these are obviously dependencies and I don't see why you would keep them as devdependencies...

@davethegr8
Copy link

I tried to use this library today, but it won't install without the listed nan dependency. I'm not going to manually manage multiple dependencies as that defeats the purpose of listing deps. :(

@strawberry-code
Copy link

strawberry-code commented Sep 12, 2019

For newbies, to solve this issue please install missing dependencies, and so:

npm install nan node-gyp

and now you can install the package:

npm install node-mac-notifier 

or using Yarn:

yarn add nan node-gyp
yarn add node-mac-notifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants