【发布时间】:2014-01-11 14:08:47
【问题描述】:
无法在 Windows 7 中安装 npm 包 PM2,我们遇到以下错误
> usage@0.3.9 install C:\Users\evaith\AppData\Roaming\npm\node_modules\pm2\node_modules\usage
> node-gyp rebuild
C:\Users\evaith\AppData\Roaming\npm\node_modules\pm2\node_modules\usage>node "C:\Program Files\nodejs\node_modules\npm\b
in\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 "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:118:
14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:81:11
gyp ERR! stack at Object.oncomplete (fs.js:107: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" "rebuil
d"
gyp ERR! cwd C:\Users\evaith\AppData\Roaming\npm\node_modules\pm2\node_modules\usage
gyp ERR! node -v v0.10.21
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
npm http 304 https://registry.npmjs.org/keypress
npm ERR! not ok code 0
PS C:\Users\evaith>
为什么要寻找 Python 路径。
【问题讨论】:
-
注意windows中的pm2。目前仅适用于 Linux 和 MacOS。在 github 或 this issue 中查看项目
-
你最好在 linux 上开发。许多具有非 JS 代码(主要是 c++)的 npm 模块并不是为在 windows 上工作而构建的。