Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
For an application using angular2 (from angular-cli with webpack), i need to consume some data in xml from a soap web service.The angular-cli that i use provide natively the library xml2js for parsing xml to json but when i try to use this library in my component using the following syntax:
import {Parser} from 'xml2js';
i got the message:
Cannot find module 'xml2js'.)
However, this library is really installed on the node_modules file.
I searched everywhere but i only found some solutions with system.js config.
Does anyone know how to use this library in an angular2 using webpack?
–
I would add this to JJB's answer.
Got the same problem. I solved it by installing theses 3 dependencies:
sax/ xmlbuilder/timers
- npm install @types/xml2js --save
npm install --save @types/sax
npm install --save @types/xmlbuilder
npm install --save @types/timers
npm install xml2js --save
npm install --save sax
npm install --save xmlbuilder
npm install --save timers
https://npmmirror.com/package/xml2js/v/0.4.0
xml2js in Angular 6: Can't resolve 'stream' and 'timers'
Regards
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.