I’m facing problems when trying to install the PostgreSQL database driver using npm on my Windows machine. The process keeps failing because of errors related to Python, even though I have added Python to my environment variables.
I’ve experimented with various ways to set the Python path, but with no luck. Here are the different formats I used:
C:/Program Files/Python"C:/Program Files/Python"C:/Program Files/Python/python.exe"C:/Program Files/Python/python.exe"
This is the error message I keep encountering:
D:\Projects\GitHub\inmotion>npm -g install pg
npm http GET https://registry.npmjs.org/pg
npm http 200 https://registry.npmjs.org/pg
npm http GET https://registry.npmjs.org/generic-pool/1.0.12
npm http 200 https://registry.npmjs.org/generic-pool/1.0.12
npm http GET https://registry.npmjs.org/generic-pool/-/generic-pool-1.0.12.tgz
npm http 200 https://registry.npmjs.org/generic-pool/-/generic-pool-1.0.12.tgz
> [email protected] install C:\Users\Guzza\AppData\Roaming\npm\node_modules\pg
> node-gyp rebuild || (exit 0)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:/Program Files/Python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:95:14)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Guzza\AppData\Roaming\npm\node_modules\pg
gyp ERR! node -v v0.8.4
gyp ERR! not ok
Has anyone faced a similar issue? What is the proper way to set up Python for npm installations on Windows?