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 [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 
2
  • 1
    Perhaps you could paste the console output in a code block so search engines can index it for future people with your error. Commented Aug 14, 2013 at 6:23
  • Have you installed all of node-gyp's external dependencies for Windows? Note that the .NET Framework may not include all the tools that node-gyp uses to build native addons. 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: stackoverflow.com/a/17830008. Commented Aug 14, 2013 at 7:19

6 Answers 6

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!

Sign up to request clarification or add additional context in comments.

2 Comments

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.
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!
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 

Comments

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.

Comments

1

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

Comments

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.

Comments

1

Please run first:

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

and then proceed installing "xml2json"

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.