Robotjs: npm install fails: SyntaxError thrown by install script (Node 10.x.x)

Created on 14 Dec 2019  Â·  1Comment  Â·  Source: octalmage/robotjs


Fresh npm install on my system does not complete successfully.

Current Behavior



Currently it fails:

> [email protected] install C:\Users\me\Projects\my_project\node_modules\robotjs
> prebuild-install || node-gyp rebuild

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

C:\Users\me\Projects\my_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 )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\me\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % 
sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
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\oscrt\Projects\my_project\node_modules\robotjs
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\me\AppData\Roaming\npm-cache\_logs\2019-12-14T21_25_26_117Z-debug.log

I am not too worried about the ABI stuff, I have already managed to get iohook to work in this project.

Possible Solution



The python on my path is python 3. The post install script only works in python 2.

Steps to Reproduce



npm install robotjs

Your Environment

  • RobotJS version: newest npm release I imagine
  • Node.js version: v10.16.3 (ABI 64)
  • Electron version: v7.1.5 (ABI 75)
  • npm version: 6.9.0
  • Operating System: Windows 10 Pro

Most helpful comment

Fixed by switching to Python 2, installing an unbelievable amount of .NET and VS stuff, and occasional jazz hands praying to the dependency gods. If you are having this issue, the thing that seemed to do it in the end was installing the windows build tools via npm:

npm install --global --production windows-build-tools

Installing the .NET Core SDK 2.x.x didn't work for me. Seems that when Microsoft released the development kit, they forgot to include the compiler needed to actually use the thing ¯\_(ツ)_/¯.

Installing the vs build tools via Chocolately (choco install vcbuildtools) also didn't work. It installed fine, but didn't seem to change anything.

If you are still having issues, have a read through this SO post. While related to a different package(s), it's the same node-gyp build problem that is occurring here.

>All comments

Fixed by switching to Python 2, installing an unbelievable amount of .NET and VS stuff, and occasional jazz hands praying to the dependency gods. If you are having this issue, the thing that seemed to do it in the end was installing the windows build tools via npm:

npm install --global --production windows-build-tools

Installing the .NET Core SDK 2.x.x didn't work for me. Seems that when Microsoft released the development kit, they forgot to include the compiler needed to actually use the thing ¯\_(ツ)_/¯.

Installing the vs build tools via Chocolately (choco install vcbuildtools) also didn't work. It installed fine, but didn't seem to change anything.

If you are still having issues, have a read through this SO post. While related to a different package(s), it's the same node-gyp build problem that is occurring here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piyushpatil027 picture piyushpatil027  Â·  3Comments

quinton-ashley picture quinton-ashley  Â·  6Comments

Androiderr picture Androiderr  Â·  4Comments

vnsharma-systango picture vnsharma-systango  Â·  9Comments

MariaDima picture MariaDima  Â·  3Comments