无法在Windows 10中使用NPM安装xml2json模块

时间:2019-06-26 17:15:34

标签: npm

我正在尝试使用npm安装xml2json,但是控制台返回以下错误

我运行npm i xml2json

然后,控制台返回此错误

C:\Users\VDSCH\Proyectos\Tossa\problemApp\node_modules\node-expat>if not defined npm_config_node_gyp (node "C:\Users\VDSCH\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\VDSCH\AppData\Roaming\npm\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:\Users\VDSCH\AppData\Local\Programs\Python\Python37-32"", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\VDSCH\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\VDSCH\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at C:\Users\VDSCH\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:282:31
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\VDSCH\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\VDSCH\Proyectos\Tossa\problemApp\node_modules\node-expat
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN problemapp@1.0.0 No description
npm WARN problemapp@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.18 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.18 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\VDSCH\AppData\Roaming\npm-cache\_logs\2019-06-26T16_59_24_765Z-debug.log

最后,我尝试重新安装node-gyp和node expat,但这些似乎不起作用。程序包有问题吗?还是我自己的系统变量中缺少某些内容?

1 个答案:

答案 0 :(得分:0)

该错误本身说明了有关找不到python可执行文件,并要求您设置PYTHON环境变量来定位它的情况。

所以,第一个问题是,您安装了python吗?如果没有,您应该install it

然后,在再次运行该过程之前,设置PYTHON环境变量以找到它。

相关问题