Xml2json安装错误找不到Python可执行文件您可以设置Python环境变量 [英] xml2json install Error Can't find Python executable you can set the PYTHON env variable

查看:11
本文介绍了Xml2json安装错误找不到Python可执行文件您可以设置Python环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装带有NPM的xml2json时遇到一些问题。

我的开发环境是这样的。

操作系统:64位Windows 10专业版 IDE:Visual Studio代码 节点版本:8.10.0

现在我做节点项目。但我无法安装xml2json。在npmjs.com

可以使用此命令安装

$ npm install xml2json

但命令表示无法安装。错误消息如下所示。

Error Message

C:UserssuperDownloadsprojectdatamyapp>npm install xml2json

> node-expat@2.3.16 install C:UserssuperDownloadsprojectdatamyapp
ode_modules
ode-expat
> node-gyp rebuild


C:UserssuperDownloadsprojectdatamyapp
ode_modules
ode-expat>if not defined npm_config_node_gyp (node "C:UserssuperAppDataRoaming
pm
ode_modules
pm
ode_modules
pm-lifecycle
ode-gyp-bin\....
ode_modules
ode-gypin
ode-gyp.js" rebuild )  else (node "C:UserssuperAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gypin
ode-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:UserssuperAppDataLocalProgramsPythonPython37-32python.EXE", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:UserssuperAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibconfigure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:UserssuperAppDataRoaming
pm
ode_modules
pm
ode_modules
ode-gyplibconfigure.js:508:16)npm
ode_modules
ode-gyplibconfigure.js:508:16)                                              fspolyfills.js:284:29
gyp ERR! stack     at C:UserssuperAppDataRoaming
pm
ode_modules
pm
ode_modulesgraceful-fspolyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\super\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"gyp ERR! cwd C:UserssuperDownloadsprojectdatamyapp
ode_modules
ode-expat
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.16 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.16 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:UserssuperAppDataRoaming
pm-cache\_logs2018-07-31T15_33_12_196Z-debug.log

我已经安装了Python并将其添加到Path中,但它仍然不起作用。我试着用错误消息解决这个问题,但没有什么能给我一个解决方案。

我已经尝试了node-gyp重建和其他方法。

推荐答案

如果其他人遇到此问题,这可能会有所帮助

  • (可选)安装PythonDownload From Here
  • 在Windows终端中以管理员身份运行以下命令
    npm install --global --production windows-build-tools

    (这将安装Windows生成工具并安装Python2.7)

    Example Image

  • 使用以下命令以管理员身份全局安装node-gyp:
    npm install node-gyp

就是这样!安装完成后,关闭并(正常)重新运行终端窗口,然后再次安装有问题的程序包,这应该会成功运行。

如果需要,您可以选中this原始帖子。

这篇关于Xml2json安装错误找不到Python可执行文件您可以设置Python环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆