-
Notifications
You must be signed in to change notification settings - Fork 607
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
Requiring unknown module 'timers' #301
Comments
That module is [part of Nodejs](https://nodejs.org/api/timers.html).
|
Thanks for fast response, I use it in React-Native project, so can you give me a clue why I get this error? |
FYI, I added |
That's odd, that module does not seem to have any `setImmediate` function, which is the only one required by xml2js.
|
It's |
Hi, Still facing this issue:
and
Adding both dependencies solves the issues but I don't think this is the way it should be handled. |
Are you running it in a non-node environment or something? |
I am running it in an Angular project on windows. |
Then you probably do need these |
Great, Thank you for the confirmation. Will it help if we add those as peer dependencies? this way one would get a warning about it. |
Hmm, maybe I am misunderstanding how that would work, but to me it doesn't look like setting them as peer dependencies will solve the issue. Another solution would be to publish an |
Cheers |
Since angular explicitly disables default node modules, the build will break on them. |
@krojew what do you mean? |
If you don't use the browser version, it tries to use node modules which angular disabled during building. Also, browser-xml2js needs setImmediate at runtime function which doesn't exist and results in an error. |
For Angular in-browser usage, add path mapping in your "compilerOptions": {
"paths": {
"timers": [
"node_modules/timers-browserify"
],
"stream": [
"node_modules/stream-browserify"
],
}
} A similar issue was discussed in angular-cli: For browser-specific shims or mocks, see https://github.com/webpack/node-libs-browser or https://github.com/browserify/browserify#compatibility . |
I think "timers" should be part of the dependencies. On environments that don't need it it will do nothing, and on those that miss it it will fix the issue. |
seems there's an issue with |
THANK YOU, this fixed the problem for me! Had to replace all references to xml2js in xml.js with x2js and azure/storage-blob no longer breaks my project! |
It seems that project is dependents on 'timers', but it's not added in the package.json
The text was updated successfully, but these errors were encountered: