Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js won't let me install the xml2json module

I've searched the web for a solution but couldn't find one. I'm a newbie to Node.js and up to now, any module I've installed was installed without any problem.

Only since yesterday when I've searched for an xml module for node.js, It started to give me a problem.

I have updated net framework sdk and did what needed , uninstalled node and installed it again, but still no solution.

The module I'm trying to install is xml2json (npm install xml2json) and here is the error:

enter image description here

The Code:

C:\Program Files (x86)\EasyPHP-12.1\www\MyFirstProject\server>npm install xml2js
on
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm http GET https://registry.npmjs.org/xml2json
npm http 304 https://registry.npmjs.org/xml2json
npm http GET https://registry.npmjs.org/node-expat/2.0.0
npm http 304 https://registry.npmjs.org/node-expat/2.0.0

> [email protected] install C:\Program Files (x86)\EasyPHP-12.1\www\MyFirstProjec
t\server\node_modules\xml2json\node_modules\node-expat
> node-gyp rebuild


C:\Program Files (x86)\EasyPHP-12.1\www\MyFirstProject\server\node_modules\xml2j
son\node_modules\node-expat>node "C:\Program Files\nodejs\node_modules\npm\bin\n
ode-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack     at errnoException (child_process.js:980:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:771:
34)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Program Files (x86)\EasyPHP-12.1\www\MyFirstProject\server\node_
modules\xml2json\node_modules\node-expat
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
like image 229
Alon Avatar asked Feb 23 '26 00:02

Alon


2 Answers

Seems like an issue with some packages that use Python for build, and with Windows 7 64bit.
Several Google searches reveal that the most popular things to try are:

  1. Downgrade node to v0.8.x

  2. Set your PYTHON env variable to "" (the empty string)

  3. Install Python in C:\Python and the set the following env variables.

    PYTHONPATH=C:\Python
    PYTHON=%PYTHONPATH%\python.exe

Good luck!

like image 96
Nitzan Shaked Avatar answered Feb 25 '26 12:02

Nitzan Shaked


I had to downgrade python from 3 to 2.

node-gyp says:

On Windows: Python (v2.7.3 recommended, v3.x.x is not supported)

This is unrelated, but most likely your next issue: If your next error is error MSB8020, then do:

$ npm install xml2json -msvs_version=2012
like image 27
Jan Avatar answered Feb 25 '26 13:02

Jan