简体   繁体   中英

npm install robotjs failed duirng to building binaries

when I run the command "npm install robotjs -g" it gives me this error.

robotjs@0.5.1 install C:\\Users\\Ehsan\\AppData\\Roaming\\npm\\node_modules\\robotjs prebuild-install || node-gyp rebuild

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

C:\\Users\\Ehsan\\AppData\\Roaming\\npm\\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 ) C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\input.py:891: Warning: 'as' will become a reserved keyword in Python 2.6 Traceback (most recent call last): File "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py", line 13, in import gyp File "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\pylib\\gyp__init__.py", line 8, in import gyp.input File "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\pylib\\gyp\\input.py", line 891 except ImportError as e: ^ SyntaxError: invalid syntax 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:336: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.17133 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\\Ehsan\\AppData\\Roaming\\npm\\node_modules\\robotjs gyp ERR! node -v v8.11.3 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! robotjs@0.5.1 install: prebuild-install || node-gyp rebuild 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\\Ehsan\\AppData\\Roaming\\npm-cache_logs\\2018-10-29T09_19_13_980Z-debug.log

I was able to install (and run) robotjs in ubuntu 20.04:

sudo apt install -y nodejs npm
sudo apt install -y libxtst-dev
sudo apt install -y libpng++-dev
npm install robotjs

Got some warnings, but robotjs was successfully installed :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM