-
Notifications
You must be signed in to change notification settings - Fork 1.3k
57.0.1 Breaks a BUNCH of stuff #4122
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
Any update on this? |
I have the same error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /node_modules/ipfs-http-client/package.json in package.json: in code: |
我遇见了同样的问题: class IpfsService { module.exports = new IpfsService() |
I don't know what dependencies you are using, but if the authors of those dependencies are expecting them to be consumed from a CJS environment, they should stick with I would suggest you ask them to revert and downgrade to |
@achingbrain That is NOT feasible to ask people I don't know or have any real contact with to update their module. Why did you break this? |
Broken unit tests lead me here. Not sure exactly the remedy that's being suggested here. I AM using import. And I'm pretty sure TypeScript is outputting ESM. My error is actually happening when I import ipfs-core. Or ipfs. Not sure what the deal is. Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in c:\Users\1330449\repos\large\node_modules\ipfs\package.json EDIT: Ok nevermind I checked the link about ESM and I have most, but not all of that. And I've run into problems with other dependencies that have kept that from working. I guess...just stick with the old one? Maybe I'll try the async loading it describes. UPDATE: That isn't practical right now and needs most of the same setup it looks like. Just gonna downgrade. |
If you are seeing |
I have the target. Adding the module breaks a bunch of other things. I'd like to do this but not all libraries are to this point. Downgrading fixed it. |
App itself works fine. Just breaks the unit tests. The tests rely on some testing libraries that must require somewhere inside of them. So I have to rid my entire testing stack of requires? Some of these things are built into the tooling. I'm not even sure that's possible for many things. I'm going to explore what I might need to do to better separate the testing setup from the app. I understand wanting to use modules. It seems excessive to force all calling code to also be a module. Like...why is IPFS the one who's gonna call lockdown on the whole system? My actual app is spitting out modules as far as I know but getting stuff set up for a browser, testing with node, and also a reasonable dev environment can be tricky at best sometimes. Not having the main package be a module allowed the testing setup to co-exist with the rest of the code nicely. Webpack is doing the builds fine but I don't have it involved with the testing. I appreciate the work that goes into this and hopefully I can learn how to address the problems I'm dealing with. I haven't actually successfully explored the dynamic import option yet because...I guess this is the first library that's made me look into it. I may just refactor IPFS out of the unit/integration tests altogether. Though that would be super disappointing. |
Ok with a little refactoring I got through the problem I was having with dynamic imports originally. But I am still getting that error even when dynamically importing. I think what you're saying must be the thing. But making the original changes you suggested breaks a bunch of stuff for me. I'm going to play around with it a bit. Maybe it won't be so bad. Thank you for coming to my TED talk. |
I have that configuration. If I run 'webpack serve' with that config it actually works fine with the most recent version of ipfs-core. But if I then add: "module": "ES2020" It breaks. And it complains about imports inside the webpack config file. Why would it work fine without the module line and then suddenly break? UPDATE: Ok I still don't know why the above works, but to my problem adding 'module'...according to this there is some problem with the combo of webpack and typescript that stops this from working. There are workarounds listed but I have not had success yet. webpack/webpack-cli#2916 UPDATE 2: Did not succeed. It seems like to use dynamic imports it needs all the same steps as just making the whole thing a module. Is there a way to have the dynamic import work properly without making it a module? It doesn't quite make sense how that's even a workaround if you need to do basically all the same stuff. Also it seems as though there is specifically a problem with TypeScript transpiling dynamic imports to require: microsoft/TypeScript#43329 |
Ok based on this post I was able to workaround this in TypeScript: microsoft/TypeScript#43329 (comment) The dynamic import had to be:
|
it's still has the same error |
Updated from @danskyr answer below. (I revisited this because I'm facing this issue in another project I'm building.) Previous answer below: For a workaround, I just downgraded to an older version: I somewhat arbitrarily picked |
I had the same problem using |
Ultimately I addressed my problem(s) by converting everything else to ESM. Which wasn't fun but seems like the way forward. The biggest problems are that both hardhat and truffle struggle in various ways when run in a project marked as a module, but I guess I'll just accept that and look for a workaround for my tests. |
Version:
57.0.1
Platform:
All
Subsystem:
ipft-http-client
Severity:
Critical - System crash, application panic.
Description:
ERROR: 06/01 17:27:03+00:00::Module NftInstance Load raised an exception ERROR [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /opt/NFTWeb+r_0.0.17/server/node_modules/ipfs-http-client/package.json
3 NPM packages in my project specify ipfs-http-client as a dependency. I do not. Each one of them fails because their package.json allows the latest version of ipfs-http-client. ...and now you removed the ability to "require" the module.
Just to be clear I have NO control over the version of the package that the other dependencies use.
The text was updated successfully, but these errors were encountered: