Node.js Can';t通过依赖于节点gyp的npm安装包

Node.js Can';t通过依赖于节点gyp的npm安装包,node.js,npm,npm-install,node-gyp,Node.js,Npm,Npm Install,Node Gyp,这是我在尝试安装软件包时遇到的错误: C:\WINDOWS\system32\node_modules\lame>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node

这是我在尝试安装软件包时遇到的错误:

C:\WINDOWS\system32\node_modules\lame>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\WINDOWS\system32\node_modules\lame
gyp ERR! node -v v10.6.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lame@1.2.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lame@1.2.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Home\AppData\Roaming\npm-cache\_logs\2018-07-08T23_48_21_208Z-debug.log

他们不得不采取行动。谢谢你抽出时间

您是否安装了python

这是您的错误:
错误:找不到Python可执行文件“C:\Program”,您可以设置Python环境变量

您还可以将python放在没有空间的路径中,以解决问题,直到问题得到解决


您是否安装了Python?这就是我看到的问题。
$npm安装--全局--生产windows构建工具
安装的Python。我应该试着自己安装吗?如果是这样的话,我该如何设置它提到的
PYTHON
环境变量?首先,您必须找到它的安装位置,然后按照以下步骤将其添加到path变量中:您可以通过在命令提示符中键入
python
并从中获取版本号来测试它是否工作。
$npm install--global--production windows build tools
Installed python。我应该试着自己安装吗?如果是这样,我如何设置它提到的
PYTHON
环境变量?问题不在于没有安装PYTHON,而是调用它的东西没有正确引用路径(
“C:\Program”
几乎肯定是
C:\Program Files
)。也就是说,我不知道该在哪里解决这个问题。在我看来,这似乎是相关模块上的一个bug。。它应该可以解决您的问题。在重新安装Python、处理环境变量以及重新安装node gyp之后,它成功了。谢谢大家的帮助。即使Python正确安装在错误消息中报告的位置,我也会遇到这个错误。让我摆脱困境的是全局重新安装node gyp:
$npm install-g node gyp
UPDATED 09/2016
If you're using Windows you can now install all node-gyp dependencies with single command (NOTE: Run As Admin in Windows PowerShell):

 $ npm install --global --production windows-build-tools
and then install the package

 $ npm install --global node-gyp
UPDATED 06/2018
https://github.com/nodejs/node-gyp/issues/809#issuecomment-155019383

Delete your $HOME/.node-gyp directory and try again.

See full documentation here: node-gyp