question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • Node Version: I’ve tried 15.0.0, 8.17.0, 12.21.0 and 14.15.5
  • Platform: Windows 10
  • Module: robotjs
I'm trying to install robotjs and its been 2 days without any luck, constantly getting this error. I have even copy pasted nan module in node-gyp node_modules and robotjs node_modules and it is still not installing nor rebuilding
gyp: Call to 'node -e "require('nan')"' returned exit status 0 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 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:351: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 Windows_NT 10.0.18363
my package.json ``` { "name": "MY SECRET PROJECT NAME", "version": "1.0.0", "description": "", "main": "main.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "electron ." }, "author": "", "license": "ISC", "dependencies": { "electron-prompt": "^1.6.1", "electron-store": "^7.0.2", "iohook": "^0.7.2", "puppeteer": "^7.1.0", "robotjs": "^0.6.0" }, "devDependencies": { "electron": "^11.3.0" }, "iohook": { "targets": [ "node-88", "electron-85" ], "platforms": [ "win32" ], "arches": [ "x64", "ia32" ] } } ```

Current Workaround:

Make a new project with npm init then run npm i robotjs, you can also use .npmrc to download directly for electron like this:

``` runtime = electron target = 11.3.0 target_arch = ia32 disturl = https://atom.io/download/atom-shell ```
after downloading and on a new project robotjs will install successfully now copy everything inside your new project's `node_modules` folder and paste it in the project's `node_modules` in which it is not working. Lastly add `robotjs: 0.6.0` or the version you downloaded to the project's `package.json`

**Culprit: ** npm

Reasoning:

npm was removing packages when running npm install command so I think removed modules were required by robotjs, now I had to manually add them in node_modules folder.

**NOTE: ** You have to do this every time if you can’t run npm i robotjs, npm rebuild.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MondoGaocommented, Mar 15, 2021

Then why is it so difficult to create the requested failing test?

after removing .node-gyp cache, this issue magically disappear, I think it may be difficult to reproduce this issue in a clean environment.

0reactions
alectrocutecommented, Jul 29, 2021

This should be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solving common issues with node-gyp - LogRocket Blog
Many node-gyp issues are actually issues with the toolchain used for building add-on code. We'll categorize these issues to offer solutions.
Read more >
Call to 'node -e "require('nan')"' returned exit status 1 when ...
I connected to my home PC with teamviewer and tried to install that package there and it worked. The package requires MSVC to...
Read more >
nodejs install iconv failure on ubuntu - Google Groups
It seems that gyp: Call to 'node -e "require('nan')"' returned exit status 0 , which seems fine but node-gpy rebuild still exit with...
Read more >
Ionic Appflow - Cannot find module 'nan'
Recently when I have built apps using Appflow I started getting a message ... gyp: Call to 'node -e "require('nan')"' returned exit status...
Read more >
Node.js – Error: Cannot find module 'nan' – iTecNote
But when I install the package inside the another node module node-gyp is failed ... gyp: Call to 'node -e "require('nan')"' returned exit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found