Code Monkey home page Code Monkey logo

Comments (16)

Toxicable avatar Toxicable commented on May 30, 2024 5

Also getting this error when building with webpack.
It's only a warning, but still annoying that it gets in the way:

WARNING in ./node_modules/sax/lib/sax.js
Module not found: Error: Can't resolve 'stream' in '/home/f.wiles/Documents/soa/node_modules/sax/lib'

from xml-js.

iMrLopez avatar iMrLopez commented on May 30, 2024 4

Hello, I just installed xml-js and I am getting this error in console... Is there any update in how to permanently fix it?

Using Angular 8.0

from xml-js.

itPiligrim avatar itPiligrim commented on May 30, 2024 1

Hello, I just installed xml-js and I am getting this error in console... Is there any update in how to permanently fix it?

Using Angular 8.0

See: https://stackoverflow.com/a/55788098/4604351

from xml-js.

marcinwadon avatar marcinwadon commented on May 30, 2024

Yes, it's a known issue. Please read #54

from xml-js.

Mazowiecki avatar Mazowiecki commented on May 30, 2024

is that possible that this error causes this: Buffer is not defined
at Object.push../node_modules/xml-js/lib/json2xml.js.module.exports [as json2xml] (json2xml.js:4)
at AppComponent.push../src/app/app.component.ts.AppComponent.registerUser
?

from xml-js.

marcinwadon avatar marcinwadon commented on May 30, 2024

I think no. IMO there must be an error in your code. What's inside your app.component.ts, in registerUser method?

from xml-js.

marcinwadon avatar marcinwadon commented on May 30, 2024

Try to replace your console.log into console.log(xml).

The second thing, firstly you're changing js into xml (js2xml) and then you want to map json to xml (json2xml) using created previously xml. json !== xml so probably that's your answer

from xml-js.

Mazowiecki avatar Mazowiecki commented on May 30, 2024

My latest post was wrong in all options. What is wrong in this? (the same error):
registerUser(form: NgForm) {
let xml = JSON.stringify(form.value);
console.log(xmljs.json2xml(xml, {compact: true, spaces: 4}));
}

from xml-js.

marcinwadon avatar marcinwadon commented on May 30, 2024

Please don't delete your comments. It can help others with similar issues

from xml-js.

marcinwadon avatar marcinwadon commented on May 30, 2024

Anyway, I've tried to reproduce your issue and I have the same error:

Buffer is not defined
at push../node_modules/xml-js/lib/json2xml.js.module.exports

from xml-js.

Mazowiecki avatar Mazowiecki commented on May 30, 2024

Is there another way when it works with Angular?

from xml-js.

marcinwadon avatar marcinwadon commented on May 30, 2024

There you can find that Buffer is internal Node.js one.

For your case, don't create json from js object, rather parse js object to xml directly:

registerUser(form: NgForm) {
 console.log(xmljs.js2xml(form.value, {compact: true, spaces: 4}))
}

from xml-js.

jblankenhorn avatar jblankenhorn commented on May 30, 2024

Same here!

from xml-js.

mribeiro avatar mribeiro commented on May 30, 2024

I don't understand how #54 is related, but maybe i'm missing context from deleted comments.
Is there a way to get rid of this warning? And, if it is something that can't be resolving isn't there a risk that something will break?

from xml-js.

HugoJBello avatar HugoJBello commented on May 30, 2024

I am also having problems using xml-js with angular 6. I am getting the same error:

ReferenceError: Buffer is not defined
    at Object.push../node_modules/xml-js/lib/json2xml.js.module.exports [as json2xml] (json2xml.js:4)

from xml-js.

ALGDB avatar ALGDB commented on May 30, 2024

Same for me, I use xmljs.js2xml in Angular 7 and got

WARNING in ./node_modules/sax/lib/sax.js
Module not found: Error: Can't resolve 'stream' in 'path\to\nodeModules\node_modules\sax\lib'

UPDATE:

I was able to "remove" the WARNING by changing in sax.js the require('stream') with require('readable-stream') is there any permanent solution to this issue?

from xml-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.