octalmage / robotjs

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

Cannot build on windows 10 for any node > v10 #587

Closed ivanix1 closed 4 years ago

ivanix1 commented 4 years ago

I have been trying to install robotjs into my nodejs based testing project, but always fails at install. I use yarn to add to my project, tried npm install but that fails with same error.

Has anyone experienced this issue? On install, it tries to build (no prebuild) but always fail. I need to use on node v12 since other packages require that major. Reviewed the build how to, and reviewed other issues here regarding building on windows and tried the many ways of compiling, even on node v10 it doesn't build. I verified that the source files exist. I tried building from Powershell initially, but also tried from cmd.exe. no luck.

Expected Behavior

It should build and install with out issue.

Current Behavior

I always get these error message no matter for node versions 10.x, 12.x ` "c1xx : fatal error C1083: Cannot open source file: '..\src\robotjs.cc': No such file or directory"

Log sample:

C:\Work\Projects\Patterson\repos\alone\node_modules\robotjs>if not defined npm_config_node_gyp (node "C:\Work\Tools\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Work\Tools\nodejs\node_modules\node-gyp\bin\node-gyp.js" rebuild ) gyp info it worked if it ends with ok gyp info using node-gyp@7.0.0 gyp info using node@12.13.0 | win32 | x64 gyp info find Python using Python version 2.7.15 found at "C:\Users\developer.windows-build-tools\python27\python.exe"
gyp info find VS using VS2015 (14.0) found at: gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio 14.0" gyp info find VS run with --verbose for detailed information gyp info spawn C:\Users\developer.windows-build-tools\python27\python.exe gyp info spawn args [ gyp info spawn args 'C:\Work\Tools\nvm\v12.13.0\node_modules\node-gyp\gyp\gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'msvs', gyp info spawn args '-I', gyp info spawn args 'C:\Work\Projects\Patterson\repos\alone\node_modules\robotjs\build\config.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Work\Tools\nvm\v12.13.0\node_modules\node-gyp\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\developer\AppData\Local\node-gyp\Cache\12.13.0\include\node\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=C:\Users\developer\AppData\Local\node-gyp\Cache\12.13.0', gyp info spawn args '-Dnode_gyp_dir=C:\Work\Tools\nvm\v12.13.0\node_modules\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\\Users\\developer\\AppData\\Local\\node-gyp\\Cache\\12.13.0\\<(target_arch)\\node.lib', gyp info spawn args '-Dmodule_root_dir=C:\Work\Projects\Patterson\repos\alone\node_modules\robotjs', 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 'C:\Work\Projects\Patterson\repos\alone\node_modules\robotjs\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe gyp info spawn args 'build/binding.sln', gyp info spawn args '/clp:Verbosity=minimal', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' gyp info spawn args ] 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 c1xx : fatal error C1083: Cannot open source file: '..\src\robotjs.cc': No such file or directory [C:\Work\Projects\Patterson\repos\alone\node_modules\robotjs\build\robotjs.vcxproj] c1xx : fatal error C1083: Cannot open source file: 'C:\Work\Tools\nvm\v12.13.0\node_modules\node-gyp\src\win_delay_load_hook.cc': No such file or directory [C:\Work\Projects\Patterson\repos\alone\node_modules\robotjs\build\robotjs.vcxproj] gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Work\Tools\nvm\v12.13.0\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:210:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Work\Tools\nodejs\node.exe" "C:\Work\Tools\nodejs\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Work\Projects\Patterson\repos\alone\node_modules\robotjs gyp ERR! node -v v12.13.0 gyp ERR! node-gyp -v v7.0.0 gyp ERR! not ok info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. PS C:\Work\Projects\Patterson\repos\alone> ^C PS C:\Work\Projects\Patterson\repos\alone> dir C:\Work\Tools\nvm\v12.13.0\node_modules\node-gyp\src\win_delay_load_hook.cc
`

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

Your Environment

ivanix1 commented 4 years ago

The root cause is due to bug in VisualStudio msbuild.exe where it cannot find source files in folder paths with case sensitive enabled. The original project path was created from WSL and the root folders start with capital letters. Workaround was to disable case sensitve and copy project to lowercase folder path (C:\tmp\project).