我在我的 Windows 机器上通过 npm安装pg时遇到问题。
它抱怨 python,但我已将 python 添加为 env。多方面的变数都无济于事。
这些都是我尝试声明环境的所有方式。变种。
C:/Program Files/Python
"C:/Program Files/Python"
C:/Program Files/Python/python.exe
"C:/Program Files/Python/python.exe"
这是错误:
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
> pg@0.8.3 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
pg@0.8.3 C:\Users\Guzza\AppData\Roaming\npm\node_modules\pg
└── generic-pool@1.0.12