octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.31k stars 951 forks source link

robotjs won't install from npm (Windows) #594

Closed TJDemigod closed 4 years ago

TJDemigod commented 4 years ago

After trying multiple versions of node and reading/troubleshooting for the last day from all the feedback given to others ie: install dependencies/node-gyp/robotjs, follow steps in the readme etc etc nothing seems to fix it. I am following the learn code by gaming tutorial linked here: https://www.youtube.com/watch?v=Uw11Lb8ov88 and am following the steps if you need to know the order in which things were done.

Expected Behavior

install robotjs with 0 errors.

Current Behavior

PS C:\Users\tjdra\Desktop\Project> npm i robotjs

robotjs@0.6.0 install C:\Users\tjdra\Desktop\Project\node_modules\robotjs prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=12.16.1 runtime=node arch=x64 libc= platform=win32)

C:\Users\tjdra\Desktop\Project\node_modules\robotjs>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. robotjs.cc win_delay_load_hook.cc cl : Command line error D8027: cannot execute 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\c1xx.dll' [C:\Users\tjdra \Desktop\Project\node_modules\robotjs\build\robotjs.vcxproj] cl : Command line error D8027: cannot execute 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\c1xx.dll' [C:\Users\tjdra \Desktop\Project\node_modules\robotjs\build\robotjs.vcxproj] cl : Command line error D8040: error creating or communicating with child process [C:\Users\tjdra\Desktop\Project\node_modules\robotjs\build\robotjs.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:311:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\tjdra\Desktop\Project\node_modules\robotjs gyp ERR! node -v v12.16.1 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok npm WARN project@1.0.0 No description npm WARN project@1.0.0 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! robotjs@0.6.0 install: prebuild-install || node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the robotjs@0.6.0 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! C:\Users\tjdra\AppData\Roaming\npm-cache_logs\2020-08-12T08_03_18_566Z-debug.log

Possible Solution

Tried all possible solutions I could find.

Steps to Reproduce (for bugs)

  1. npm install robotjs
  2. Steps are listed in link if complete list of steps are needed.

Context

Trying to get this running so I can progress with the tutorial and learn something new.

Your Environment

MoonEgret commented 4 years ago

On my computer(win10 x64) 1.nodejs: v12.18.3 (earlier than 11.x.x can’t prebuild-install) 2.node-gyp: v7.0.0 (make sure you have installed [Visual Studio Build Tools] and [Python v2.7.x]) 3.electron: v6.0.7 (earlier than 3.1.13 can‘t work) before i uninstall my [Visual Studio 2015],robotjs can‘t be rebuild command 1.npm install -g node-gyp 2.npm install robotjs (nodejs will use its own node-gyp@5.1.0 to prebuild, i guess) 3.cd .\node_modules\robotjs\ 4.node-gyp rebuild --target=6.0.7 --arch=x64 --target_platform=darwin --dist-url=https://npm.taobao.org/mirrors/atom-shell step 4 is necessary.[your node-gyp.js] rebuild --target=[electron version] --arch=[ia32|x64] --target_platform=darwin --dist-url=[Download header tarball from custom URL] --target version should be --dist-url electron-builder will rebuild robotjs if not set

   "nodeGypRebuild": false,
    "buildDependenciesFromSource": false,
    "npmRebuild": false,
TJDemigod commented 4 years ago

Thank you for the information. I installed build tools via Visual Studio as before it was via the additional tools for Node install and installed electron. After doing it this way there were no more errors.