ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

Import of ipfs-http-client crashing in Next.js #4128

Closed 10dimensions closed 1 year ago

10dimensions commented 2 years ago

Module not found: Package path . is not exported from package C:\projects\amberfi\dapp\my-dapp\node_modules\ipfs-http-client (see exports field in C:\projects\amberfi\dapp\my-dapp\node_modules\ipfs-http-client\package.json)    8 | });    9 | };

10 | import { create as ipfsHttpClient } from 'ipfs-http-client';      | ^   11 | export class IUploadHandler {   12 | constructor(initParams) {   13 | }

Version: 57.0.1

Severity:

Critical - System crash, application panic.

Description:

Imported ipfs-http-client module. Which is referenced by an internal npm package. Finally, import inside a Next.js UI component

Steps to reproduce the error:

welcome[bot] commented 2 years ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

BigLep commented 2 years ago

@10dimensions : can you please provide a reproducible repo? In case it helps, please be aware of some recent breaking changes that were made: https://github.com/ipfs/js-ipfs/blob/master/docs/upgrading/v0.62-v0.63.md

rawatnaresh commented 2 years ago

i'm getting similar issue while using it with cloud functions. i've created an issue with reproducible demo https://github.com/ipfs/js-ipfs/issues/4180

achingbrain commented 1 year ago

Module not found: Package path . is not exported from package means you are trying to require an ESM module.

Your source code is in ESM but chances are your output settings are producing CJS - please check the output folder for the type of JS being emitted and update your config to emit ESM instead.

rafinskipg commented 1 year ago

@achingbrain i'm having the same problem trying to create a github action that uses this package. i use vercel/ncc to build and i have no idea what this package is missing in order to be used.