Kong / docker-kong-js-pdk

Apache License 2.0
8 stars 9 forks source link

Build Failure due to python version #7

Open deepakgrewal opened 2 years ago

deepakgrewal commented 2 years ago

Running docker compose up encounters errors because node-gyb module requires the latest version of python. If we just update the python version to python3 then we encounter other errors when installing kong-pdk@0.3.0 (which is not compatible with the latest version of python)

The best way to resolve this is to update both python & kong-pdk versions in the Dockerfile

> [3/4] RUN npm install --unsafe -g kong-pdk@0.3.0:
#6 5.380 npm ERR! code 1
#6 5.380 npm ERR! path /usr/local/lib/node_modules/kong-pdk/node_modules/msgpack
#6 5.383 npm ERR! command failed
#6 5.383 npm ERR! command sh -c node-gyp rebuild
#6 5.384 npm ERR! gyp info it worked if it ends with ok
#6 5.384 npm ERR! gyp info using node-gyp@8.3.0
#6 5.384 npm ERR! gyp info using node@16.13.2 | linux | x64
#6 5.384 npm ERR! gyp ERR! find Python
#6 5.384 npm ERR! gyp ERR! find Python checking Python explicitly set from command line or npm configuration
#6 5.384 npm ERR! gyp ERR! find Python - "--python=" or "npm config get python" is "/usr/bin/python3"
#6 5.384 npm ERR! gyp ERR! find Python - "/usr/bin/python3" is not in PATH or produced an error
#6 5.384 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#6 5.384 npm ERR! gyp ERR! find Python checking if "python3" can be used
#6 5.384 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#6 5.386 npm ERR! gyp ERR! find Python checking if "python" can be used
#6 5.386 npm ERR! gyp ERR! find Python - executable path is "/usr/bin/python"
#6 5.386 npm ERR! gyp ERR! find Python - version is "2.7.18"
#6 5.386 npm ERR! gyp ERR! find Python - version is 2.7.18 - should be >=3.6.0
#6 5.386 npm ERR! gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
#6 5.386 npm ERR! gyp ERR! find Python
#6 5.386 npm ERR! gyp ERR! find Python **********************************************************
#6 5.386 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#6 5.386 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#6 5.386 npm ERR! gyp ERR! find Python you can try one of the following options:
#6 5.386 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#6 5.386 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#6 5.386 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#6 5.386 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#6 5.386 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#6 5.386 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#6 5.386 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#6 5.386 npm ERR! gyp ERR! find Python **********************************************************
#6 5.386 npm ERR! gyp ERR! find Python
#6 5.386 npm ERR! gyp ERR! configure error
#6 5.386 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#6 5.386 npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
#6 5.387 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
#6 5.387 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:266:16)
#6 5.387 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:297:7)
#6 5.387 npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:388:7)
#6 5.387 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
#6 5.387 npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
#6 5.387 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
#6 5.387 npm ERR! gyp ERR! System Linux 5.10.47-linuxkit
#6 5.387 npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#6 5.387 npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/kong-pdk/node_modules/msgpack
#6 5.387 npm ERR! gyp ERR! node -v v16.13.2
#6 5.387 npm ERR! gyp ERR! node-gyp -v v8.3.0
#6 5.387 npm ERR! gyp ERR! not ok
#6 5.394
#6 5.394 npm ERR! A complete log of this run can be found in:
#6 5.394 npm ERR!     /root/.npm/_logs/2022-02-10T08_23_05_672Z-debug.log
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c npm install --unsafe -g kong-pdk@0.3.0]: exit code: 1
hazem-elsayed commented 2 years ago

@deepakgrewal , I have been suffering from this issue, thank you.