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

Util dependency not specified in package.json #14

Open
vitorsgomes opened this issue Mar 8, 2017 · 9 comments
Open

Util dependency not specified in package.json #14

vitorsgomes opened this issue Mar 8, 2017 · 9 comments

Comments

@vitorsgomes
Copy link

In the file lib/avltree.js there is a require for util, but this lib was never specified as a dependency in package.json.

When trying to use node-binary-search-tree on a project that don't have util as a dependency it's generate an error.

@amaramth
Copy link

amaramth commented Mar 27, 2017

How do you have a project that doesn't have util as a dependency?

@Alttaf
Copy link

Alttaf commented May 26, 2017

I have a similar problem in a react native project, when including binary tree it complains about being unable to resolve util in avltree.js, understood this is native node, but how could this happen?

@Alttaf
Copy link

Alttaf commented May 26, 2017

this could be from the above facebook/react-native#526, seems like it is a react native issue you have to npm install util as a workaround

@dinithminura
Copy link

@Alttaf, Yes, that solution works!

@marcolino
Copy link

I suppose you miss a util dependency in your package.json... Please add it...

@amaramth
Copy link

@marcolino util is built in

@marcolino
Copy link

What do you mean by builtin? If I do not add it to my project dependencies, I can't build my project, which has node-binary-search-tree as a sub-sub-sub dependency... :-(

@JamesMGreene
Copy link
Contributor

JamesMGreene commented Aug 27, 2017

@alice0meta means that util is a core Node.js module. Project dependencies are external userland modules from NPM.

This is strictly an incompatibility with React Native not fully supporting a Node.js-compatible environment, and it is going to be extremely common among many Node modules you try to require unless they have been browserify-ed (or intentionally made compatible with React Native) since depending on such core modules like util (for inherits, usually) or events (for EventEmitter) is extremely common.

@deive
Copy link

deive commented Sep 26, 2017

I have made a pull request that simply copies the inherits method from node.js utils to customUtils, so there is no longer a dependency on the node module. The correct way of doing this is to upgrade to ES6 as inherits is deprecated anyway, but this is simple and fast... #17 (useful if you don't want/need the utils package - as mentioned by @Alttaf)

cowboyd added a commit to cowboyd/impagination that referenced this issue Oct 30, 2017
binary-search-tree requires `util`, but does not enumerate it as a
dependency. This is a known issue with it
louischatriot/node-binary-search-tree#14

This adds `util` as a primary dependency so that this require will not
fail. While we're fixing up meta-information, this adds build time
artifacts  `/lib` and `/yarn.lock` to the ignore list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants