mfirry
mfirry

Reputation: 3692

Issue installing postgres with npm

I'm having issues installi pg via npm on my windows machine.

It complains about python but I've added python as env. variable in many ways to no avail.

These are all the ways I tried declaring the env. var.

Here's the error:

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)


C:\Users\Guzza\AppData\Roaming\npm\node_modules\pg>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
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! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:59:11
gyp ERR! stack     at Object.oncomplete (fs.js:297:15)
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! node-gyp -v v0.6.1
gyp ERR! not ok
[email protected] C:\Users\Guzza\AppData\Roaming\npm\node_modules\pg
└── [email protected]

Upvotes: 2

Views: 1861

Answers (1)

Craig Ringer
Craig Ringer

Reputation: 324771

Try C:\PROGRA~1\Python as your environment entry, presumably for the PYTHON environment variable. If the shortname for Program Files is different on your install, check with:

  1. Start->run or hold the windows-key and press R
  2. cmd.exe enter
  3. cd "Program Files" enter
  4. dir

If I recall correctly the shortname should be listed alongside the long name for directories.

Please report this as a bug to whoever maintains the software you're using, they need to fix their code to handle spaces in paths correctly.

Upvotes: 1

Related Questions