2

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 server@0.0.1 No repository field.
npm WARN package.json server@0.0.1 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

> node-expat@2.0.0 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
Henrik Andersson
  • 45,354
  • 16
  • 98
  • 92
Alon
  • 3,734
  • 10
  • 45
  • 64
  • 1
    Perhaps you could paste the console output in a code block so search engines can index it for future people with your error. – icktoofay Aug 14 '13 at 06:23
  • Have you installed all of `node-gyp`'s [external dependencies](https://github.com/TooTallNate/node-gyp#installation) for Windows? Note that the .NET Framework may not include all the tools that `node-gyp` uses to build [native addons](http://nodejs.org/api/addons.html). This is why it recommends Visual Studio (Express). If you have installed or choose to install VS 2012, you may also need to specify that when installing packages: http://stackoverflow.com/a/17830008. – Jonathan Lonowski Aug 14 '13 at 07:19

6 Answers6

3

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!

TheCodeArtist
  • 21,479
  • 4
  • 69
  • 130
Nitzan Shaked
  • 13,460
  • 5
  • 45
  • 54
  • 1
    Looks like currently only older version of python is supported. `gyp ERR! stack Error: Python executable "C:\Programy\Python_3_3_2\python.exe" is v3.3.2, which is not supported by gyp. gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.` – JanM Sep 12 '13 at 16:38
  • When reading this answer, pay close attention to "Windows 7 64-bit." I tried everything on this page and everything else I could think of, and finally what made it work was the 32-bit edition of Node 0.10.36! – blisstdev Apr 07 '15 at 01:58
2

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
Community
  • 1
  • 1
Jan
  • 2,747
  • 27
  • 35
1

I've had the exact same problem. For me it was that PYTHON var pointed to the installation directory, and not the executable itself.

danbars
  • 300
  • 1
  • 3
  • 14
1

Better also check that you got all the rquirements of node-gyp.
For me - adding the binding.gyp file solved the problem.

chenop
  • 4,743
  • 4
  • 41
  • 65
1

The requeriments for xml2json on windows is:

Python, Visual Studio 2015 o newer, windows software development kit 8.1 and Visual C++ tools.

Check the config on Visual Studio.

1

Please run first:

npm install --global --production windows-build-tools

and then proceed installing "xml2json"

Petre Sosa
  • 2,097
  • 1
  • 23
  • 19