Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp.

Open
#79 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp, linux, nodejs

Research direction

Start by reading binding.gyp and running the documented node-gyp rebuild steps with the reported Node.js and Linux versions. Investigate why the nan module cannot be resolved during binding.gyp evaluation; done means the native addon builds successfully without the reported error.

Written by the indexing model from the issue text.

Description

When running node-gyp rebuild step from the following instructions

$ npm install node-gyp -g
$ git clone git://github.com/c4milo/node-inotify.git
$ cd node-inotify
$ node-gyp rebuild

I get this error:

(base) ➜  node-inotify git:(master) node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@9.0.0
gyp info using node@16.14.2 | linux | x64
gyp info find Python using Python version 3.7.0 found at "/home/user/miniconda3/bin/python3"
gyp info spawn /home/user/miniconda3/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/user/.nvm/versions/node/v16.14.2/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/user/tmp/node-inotify/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/user/.nvm/versions/node/v16.14.2/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/user/.cache/node-gyp/16.14.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/user/.cache/node-gyp/16.14.2',
gyp info spawn args   '-Dnode_gyp_dir=/home/user/.nvm/versions/node/v16.14.2/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/user/.cache/node-gyp/16.14.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/user/tmp/node-inotify',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'nan'
Require stack:
- /home/user/tmp/node-inotify/[eval]
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at [eval]:1:1
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:305:38)
    at node:internal/process/execution:76:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:75:60) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/user/tmp/node-inotify/[eval]' ]
}
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 (/home/user/.nvm/versions/node/v16.14.2/lib/node_modules/node-gyp/lib/configure.js:261:16)
gyp ERR! stack     at ChildProcess.emit (node:events:526:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.16.0+
gyp ERR! command "/home/user/.nvm/versions/node/v16.14.2/bin/node" "/home/user/.nvm/versions/node/v16.14.2/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/user/tmp/node-inotify
gyp ERR! node -v v16.14.2
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok 

Dominant language
C++
Stars
242
Forks
39
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c4milo/node-inotify

All issues in c4milo/node-inotify

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.