Closed Littleor closed 5 years ago
Hi @Littleor,
We will need a bit more information to reproduce the issue.
Here is what I've tried:
First I've installed xml2json
in a fresh directory:
$ npm i xml2json
> node-expat@2.3.18 install /.../tmp/node_modules/node-expat
> node-gyp rebuild
CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
CC(target) Release/obj.target/expat/deps/libexpat/lib/xmltok.o
CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlrole.o
LIBTOOL-STATIC Release/libexpat.a
CXX(target) Release/obj.target/node_expat/node-expat.o
SOLINK_MODULE(target) Release/node_expat.node
npm WARN saveError ENOENT: no such file or directory, open '/.../tmp/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/.../tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.
+ xml2json@0.11.2
added 12 packages from 54 contributors and audited 12 packages in 4.236s
found 0 vulnerabilities
And then when I try to require it, it works just fine:
$ node -p 'require("xml2json")'; echo $?
{ toJson: [Function], toXml: [Function] }
0
My code :
const parser = require('xml2json');
It shows:
Uncaught TypeError: Cannot read property 'indexOf' of undefined