-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
BN from Elliptic included twice by browserify #1923
Comments
Usually that means that there are two different versions of that module in your tree. |
@fanatid looks like it's on elliptic side (did install the latest version to be sure, the one available via npm):
./node_modules/bn.js Strangely And on bitcoin-transactions or anything including elliptic in node_modules: [email protected] extraneous npm ERR! extraneous: [email protected] /blabla/bitcoin-transactions/node_modules/elliptic/node_modules/bn.js |
Hmm, that looks like a problem in your install tree. Did you maybe go into the node_modules/elliptic folder and run npm install there at some point? It's fine and will work, but it does cause things like these extraeneous dependency installations. Either way, it would be fixed by removing the node_modules folder and doing npm install it your project folder again. The 'did you turn it off and on again' of npm :D |
For me it's a problem in the elliptic install tree, because I just reinstalled it elsewhere to be sure, @fanatid continuing this on elliptic issue Off the record, I have to say, I really hate npm, maybe I will love it one day when this thing will work correctly Thanks for the answers @goto-bus-stop |
I really don't think there's anything wrong with elliptic. Your Make sure you're using a recent version of npm (use |
Yes, you were probably right, see indutny/elliptic#190 (comment) I don't remember how I installed elliptic first, maybe an old version of npm or just an unzip of master at that time, reinstalling with current npm does not produce the same result (elliptic node_modules are included in the root node_modules) Still, I don't get very well what npm has to do with this and browserify, and why the current install duplicates bn, I will not change it since it saves a little in fact and I prefer to have each package completely separated Maybe take a little look at the node_modules/elliptic dir in bitcoin-transactions if you can see what causes the problem (not for me but that might happen for other projects, maybe browserify could detect and correct it) |
browserify bundles files as they appear on your filesystem, so how npm installs it directly affects that. There is additional deduping inside browserify for identical files, for old npm versions that did not reduce duplicates. Browserify can only look at the file contents for its deduping though, and different versions of packages usually have slightly different files.
Recent npm versions basically assume that npm controls the entire node_modules folder, so it's generally a good idea to only use npm's cli to make changes to it, unless you have a good reason.
…On September 2, 2019 5:44:19 PM GMT+01:00, Aymeric Vitte ***@***.***> wrote:
Yes, you were probably right, see
indutny/elliptic#190 (comment)
I don't remember how I installed elliptic first, maybe an old version
of npm or just an unzip of master at that time, reinstalling with
current npm does not produce the same result (elliptic node_modules are
included in the root node_modules)
Still, I don't get very well what npm has to do with this and
browserify, and why the current install duplicates bn, I will not
change it since it saves a little in fact and I prefer to have each
package completely separated
Maybe take a little look at the node_modules/elliptic dir in
bitcoin-transactions if you can see what causes the problem (not for me
but that might happen for other projects, maybe browserify could detect
and correct it)
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#1923 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
The good reason I have is to keep the modules separated, I usually install via npm then copy the modules in node_modules, therefore there is usually other subsequent node_modules dirs in the tree One might say that this is the old way but I prefer to do it like this and deduplicate/clean myself if needed, so I don't have a mess in node_modules with everything mixed and 1% used (and for the very reason that you give, ie some identical files can have some slight differences), additionnaly it happens often that I have to modify said modules and usually don't really care of the updates for those modules Now I don't understand very well why in my specific case BN is duplicated twice, probably it desserves some investigations (indeed everything looks fine in elliptic and if I remove the call to BN for bitcoin-transactions, BN is still duplicated) |
First congratulations for browserify, I tried it some years ago and a very few was working, now it's working very well
This is a small issue here so you can close it if you like, see indutny/bn.js#227 , while browserifying https://github.com/Ayms/bitcoin-transactions (see the code in html dir and README in browserify)
The BN code from Elliptic module is included twice by browserify, it does not look like an issue at bitcoin-transactions or elliptic side finally, but not sure, please let me know you thoughts
The text was updated successfully, but these errors were encountered: