Closed jameswang2015 closed 5 years ago
Getting node-gyp to run happily on Windows can be quite challenging. Not sure if they ever fixed it, but there was an open ticket regarding node-gyp not working with Python 3. Possible workaround:
npm install --global --production windows-build-tools
npm config set python C:\Users\USERNAME\.windows-build-tools\python27\python.exe
Obviously you'll want to replace the path with the location of your Python 2.7 install, and if you already have a Python 2.7 install, you can skip Step 1.
I have python 3 on my window 10 PC and get following error when running nmp install node-teradata, as below: ` C:\dev\node>npm install node-teradata
C:\dev\node\node_modules\java>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\zw803k\AppData\Local\Continuum\anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack File "", 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:289:12)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
gyp ERR! System Windows_NT 10.0.16299
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:\dev\node\node_modules\java
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\dev\node\package.json'
npm WARN node No description
npm WARN node No repository field.
npm WARN node No README data
npm WARN node No license field.
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! java@0.9.1 install:
node-gyp rebuild
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the java@0.9.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\zw803k\AppData\Roaming\npm-cache_logs\2018-11-29T08_18_44_644Z-debug.log`
this looks like an issue with python3 - in python 3 the print should be print() instead. am I right? and how to fix this? thanks