robotjs: Windows - Fail to install robotjs multiple errors: MSB4019 & C2500 & C2600

NPM fails to install robotjs on windows. There are multiple errors. I got the following error the first time I ran npm i robotjs after installing windows build tools and node-gyp. Error: error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.. Then after I closed and reopened VS Code and ran the same command again, I got a full page or errors:

$ npm i robotjs

> robotjs@0.5.1 install D:\Projects\Spotify-Muter\node_modules\robotjs
> prebuild-install || node-gyp rebuild

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

D:\Projects\Spotify-Muter\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
d:\projects\spotify-muter\node_modules\robotjs\src\os.h(26): warning C4005: 'STRICT': macro redefinition (compiling source file ..\src\robotjs.cc) [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.v
cxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\shared\minwindef.h(23): note: see previous definition of 'STRICT' (compiling source file ..\src\robotjs.cc)
..\src\robotjs.cc(63): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(63): error C2789: 'x': an object of const-qualified type must be initialized [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj] 
  ..\src\robotjs.cc(63): note: see declaration of 'x'
..\src\robotjs.cc(64): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(64): error C2789: 'y': an object of const-qualified type must be initialized [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj] 
  ..\src\robotjs.cc(64): note: see declaration of 'y'
..\src\robotjs.cc(97): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(98): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(114): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(115): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(143): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(143): error C2512: 'v8::String::Utf8Value::Utf8Value': no appropriate default constructor available [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(159): error C2661: 'v8::Value::BooleanValue': no overloaded function takes 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(239): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(251): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(252): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(418): error C2039: 'Handle': is not a member of 'v8' [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
  c:\users\jim fang\.node-gyp\12.2.0\include\node\v8-platform.h(16): note: see declaration of 'v8'
..\src\robotjs.cc(418): error C2065: 'Handle': undeclared identifier [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(418): error C2275: 'v8::Value': illegal use of this type as an expression [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
  ..\src\robotjs.cc(418): note: see declaration of 'v8::Value'
..\src\robotjs.cc(418): error C2065: 'value': undeclared identifier [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(418): error C2065: 'flags': undeclared identifier [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(418): error C2275: 'MMKeyFlags': illegal use of this type as an expression [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
  d:\projects\spotify-muter\node_modules\robotjs\src\keypress.h(50): note: see declaration of 'MMKeyFlags'
..\src\robotjs.cc(419): error C2448: 'GetFlagsFromString': function-style initializer appears to be a function definition [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(424): error C2039: 'Handle': is not a member of 'v8' [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
  c:\users\jim fang\.node-gyp\12.2.0\include\node\v8-platform.h(16): note: see declaration of 'v8'
..\src\robotjs.cc(424): error C2065: 'Handle': undeclared identifier [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(424): error C2275: 'v8::Value': illegal use of this type as an expression [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
  ..\src\robotjs.cc(424): note: see declaration of 'v8::Value'
..\src\robotjs.cc(424): error C2065: 'value': undeclared identifier [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(424): error C2065: 'flags': undeclared identifier [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(424): error C2275: 'MMKeyFlags': illegal use of this type as an expression [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
  d:\projects\spotify-muter\node_modules\robotjs\src\keypress.h(50): note: see declaration of 'MMKeyFlags'
..\src\robotjs.cc(425): error C2448: 'GetFlagsFromValue': function-style initializer appears to be a function definition [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(457): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(457): error C2512: 'v8::String::Utf8Value::Utf8Value': no appropriate default constructor available [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(463): error C2064: term does not evaluate to a function taking 2 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(515): error C2064: term does not evaluate to a function taking 2 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(589): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(603): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(639): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(640): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(708): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(709): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(710): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(711): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(768): error C2660: 'v8::Value::Uint32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(769): error C2660: 'v8::Value::Uint32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(770): error C2660: 'v8::Value::Uint32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(771): error C2660: 'v8::Value::Uint32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(772): error C2660: 'v8::Value::Uint32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(774): warning C4996: 'v8::Object::Get': was declared deprecated [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
  c:\users\jim fang\.node-gyp\12.2.0\include\node\v8.h(3412): note: see declaration of 'v8::Object::Get'
..\src\robotjs.cc(788): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(789): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [D:\Projects\Spotify-Muter\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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:257: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 D:\Projects\Spotify-Muter\node_modules\robotjs
gyp ERR! node -v v12.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN spotify_muter@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! robotjs@0.5.1 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the robotjs@0.5.1 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\Jim Fang\AppData\Roaming\npm-cache\_logs\2019-05-20T02_34_16_256Z-debug.log

I will provide the debug log of both of these runs below in the logs section. Also when installing the latest version of windows build tools (5.1.0) the shell freezes after installing python 2.7. See my comment here for a screenshot: https://github.com/octalmage/robotjs/issues/398#issuecomment-493817762 So I just ended up installing 4.0.0 of the build tools instead of 5.1.0

Expected Behavior

robotjs to be installed successfully.

Current Behavior

NPM installation to install robotjs is erroring.

Possible Solution

No idea.

Steps to Reproduce (for bugs)

  1. npm i robotjs (With or without windows build tools & node-gyp)

Context

I am trying to use robotjs in an electron app, but this technically should not matter since I am having trouble to get the thing to even install correctly.

Your Environment

  • RobotJS version: Latest from npm i robotjs (0.5.1)
  • Node.js version: 12.2.0
  • npm version: 6.9.0
  • Operating System: Windows 10 Home 1903 Build 18362.113

Steps taken to try to fix:

Referenced these issues: https://github.com/octalmage/robotjs/issues/253 https://github.com/octalmage/robotjs/issues/264 https://github.com/octalmage/robotjs/issues/398 Nothing worked even after I manually installed and reinstalled windows build tools for about 7 times. Also manually installing node-gyp did not help either.

Logs

1st run (the one before I closed VS Code, run without the page full of errors. This was right after windows build tools finished in an admin cmd): https://pastebin.com/H7p996Tc (debug logs are 1800 lines long, so I decided it would be a good idea not to post them here)

2nd run (after restarting VS Code): https://pastebin.com/nJfQ3hZC

Here is the log of windows build tools successfully installing: https://pastebin.com/uUq916cm

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 18 (1 by maintainers)

Most upvoted comments

折磨老子一个晚上,妈逼的 用中文写上解决方案,不给老外们读懂的机会。 告诉大家,这个逼库贼恶心,用npm rebiuld根本别想指定ABI

我各种对比打印electron各个版本使用的node版本,终于搞定

方法是用cnpm来去rebiuld

在package.json里加入 “rebuild”: “npm rebuild robotjs --runtime=electron --target=4.2.4 --disturl=https://atom.io/download/atom-shell --abi=69”

然后不要运行npm run rebiuld 要运行cnpm run rebiuld 然后你就发现这个robotjs各种咔咔一顿编译.cc 然后成功。。

I have updated all the deprecated functions for v8 which allows to use it with Nodejs 12.x.x There are still some deprecation warnings but library compiles well and works fine. I have submitted a pull request. In the meantime you can point your package.json to master branch of my fork sidharth0094/robotjs. I am running nodejs v12.3.1 Hope this helps. 😃

A new version of robotjs supporting the latest NodeJS version will be published soon.

I got mine to work. I am using it w/ electron. I downgraded to 11.15.0, then rebuilt all my dependencies on 11.15.0. Took awhile, but eventually it worked. I rebuilded robotjs using npm rebuild --runtime=electron --target=4.2.0 --disturl=https://atom.io/download/atom-shell --abi=69. I also moved back to electron 4.2.0 from v5 since v5 requires node v12. Then rebuilt robotjs w/ NODE_MODULE_VERSION 69 (which is what electron 4.2.0 was on). Hope this helps - especially if you are using robot w/ electron.

I had to install npm install --global windows-build-tools as admin. After that, it was possible to install. My node version is v12.16.1

The new robotjs version has been published but there is a bug into the NodeJS core about the screen sizing, it should be packaged soon into a new NodeJS version https://github.com/libuv/libuv/issues/2566

A new version of robotjs supporting the latest NodeJS version will be published soon.

@oktapodia Do you know when it is expected to be published?

Ran into the same issue. Using NVM I was able to install node 8.10 and get it working without having to uninstall node 12.

https://github.com/coreybutler/nvm-windows