Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error in running a js file using xml2json in windows #197

Open
vipgr opened this issue May 11, 2019 · 6 comments
Open

Getting error in running a js file using xml2json in windows #197

vipgr opened this issue May 11, 2019 · 6 comments

Comments

@vipgr
Copy link

vipgr commented May 11, 2019

Getting error in running a js file using xml2json in windows.
i have installed the package in node modules using npm install -g xml2json and it run with out error , still showing the same error .. no idea , i have did manythings included installed vs studio and .net frame work . still the same ..

please help me to figure out it something to resolve this issue
below are the screenshots

E:\vipin\NodeJsLearning\NodeProgs>node Read_Writexml.js
internal/modules/cjs/loader.js:584
throw err;
^

Error: Cannot find module 'xml2json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (E:\vipin\NodeJsLearning\NodeProgs\Read_Writexml.js:2:18)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)

After installing npm install -g xml2json

E:\vipin\NodeJsLearning\NodeProgs>npm install -g xml2json
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to
upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to
upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to
upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/topo. Please update your dependencies
as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/hoek. Please update your dependencies
as this version is no longer maintained an may contain bugs and security issues.
C:\Users\Vipinswathi\AppData\Roaming\npm\xml2json -> C:\Users\Vipinswathi\AppData\Roaming\npm\node_modules\xml2json\bin\xml2json

E:\vipin\NodeJsLearning\NodeProgs>npm install node-expat

[email protected] install E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat
node-gyp rebuild

E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat>if not defined npm_config_node_gyp (node "F:\Nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "F:\Nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: Missing input files:
E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\deps\libexpat......\deps\libexpat\version.c
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
xmlparse.c
xmltok.c
xmlrole.c
win_delay_load_hook.cc
expat.vcxproj -> E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\Release\libexpat.lib
node-expat.cc
win_delay_load_hook.cc
e:\vipin\nodejslearning\nodeprogs\node_modules\node-expat\node-expat.cc(103): warning C4996: 'v8::Value::ToObject': was d
eclared deprecated [E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\node_expat.vcxproj]
c:\users\vipinswathi.node-gyp\10.15.3\include\node\v8.h(10046): note: see declaration of 'v8::Value::ToObject'
e:\vipin\nodejslearning\nodeprogs\node_modules\node-expat\node-expat.cc(470): warning C4996: 'v8::Value::Int32Value': was
declared deprecated [E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\node_expat.vcxproj]
c:\users\vipinswathi.node-gyp\10.15.3\include\node\v8.h(2478): note: see declaration of 'v8::Value::Int32Value'
Creating library E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\Release\node_expat.lib and object E
:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\Release\node_expat.exp
Generating code
e:\vipin\nodejslearning\nodeprogs\node_modules\node-expat\deps\libexpat\lib\xmlrole.c : fatal error C1083: Cannot open co
mpiler intermediate file: 'E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\Release\node_expat.ipdb': Perm
ission denied [E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\node_expat.vcxproj]
LINK : fatal error LNK1257: code generation failed [E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat\build\node_
expat.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (F:\Nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "F:\Nodejs\node.exe" "F:\Nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd E:\vipin\NodeJsLearning\NodeProgs\node_modules\node-expat
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'E:\vipin\NodeJsLearning\NodeProgs\package.json'
npm WARN NodeProgs No description
npm WARN NodeProgs No repository field.
npm WARN NodeProgs No README data
npm WARN NodeProgs No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\Vipinswathi\AppData\Roaming\npm-cache_logs\2019-05-11T14_30_53_465Z-debug.log

@p3x-robot
Copy link
Contributor

@jobe451
Copy link

jobe451 commented Apr 9, 2021

same issue here
node v14.16.1
npm 7.9.0

@p3x-robot
Copy link
Contributor

try this, maybe it works, it is a bit updated: https://github.com/patrikx3/xml2json

@jobe451
Copy link

jobe451 commented Apr 9, 2021

Unfortunately I need node-expat directly, no need to convert to json. I have too stream very large xml-files. I installed node 14 on a vanilla machine, there I can install node-expat without problems. My dev machine is a couple of years old and had various older node-versions installed. There I get this issue. On both machines I hade node 14 install all the build tools. I guess build-tools are somewhat missconfigured on my older machine but I cant figure out what it is...

@jst4rk
Copy link

jst4rk commented Feb 2, 2023

In Windows 10/11

  • Ensure you have an stable internet connection
  • Try to run the "install_tools.bat" inside the nodejs folder at Program Files in you system drive
  • If fails, Try to manually install Visual Studio with the C++ Desktop Workload
  • Download and Install python 2.7 and set up an environment var if it's not created, and put in the top of the list in the systems path.
  • Open a console and type "npm config set msvs_version 2019" the year must be equal of the Visual Studio version that you have installed
  • In the console above type "npm config set python C:\Python27"

That's it. This work for me. I hope it helps you.
https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules
image

@KRK224
Copy link

KRK224 commented Apr 6, 2023

In Windows 10/11

  • Ensure you have an stable internet connection
  • Try to run the "install_tools.bat" inside the nodejs folder at Program Files in you system drive
  • If fails, Try to manually install Visual Studio with the C++ Desktop Workload
  • Download and Install python 2.7 and set up an environment var if it's not created, and put in the top of the list in the systems path.
  • Open a console and type "npm config set msvs_version 2019" the year must be equal of the Visual Studio version that you have installed
  • In the console above type "npm config set python C:\Python27"

That's it. This work for me. I hope it helps you. https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules image

Thanks! it works perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants