nftstorage / nft.storage

**Notice: Uploads Decommissioned - Existing Data is Safe!** NFT.Storage Classic (classic.nft.storage) offers free decentralized storage and bandwidth for NFTs on IPFS and Filecoin. June 2024 Update: No new uploads, but all existing data is safe. Try the new NFT.Storage, which preserves data in long term Filecoin storage. Go to app.nft.storage
https://classic.nft.storage
Other
619 stars 167 forks source link

This package itself specifies a main module field that could not be resolved #1263

Closed prajwolrg closed 3 months ago

prajwolrg commented 2 years ago

I am trying to implement use web3storage with the react-native application to easily upload file in IPFS. I successfully installed web3.storage with npm i nft.storage When I try to import inside my file with import { NFTStorage, File } from 'nft.storage', I get the following error: While trying to resolve module web3.storage from file /home/prajwolrg/School/Vaccination/vaccine_frontend/app/pages/UserSetupImage.js, the package /home/prajwolrg/School/Vaccination/vaccine_frontend/node_modules/nft.storage/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/home/prajwolrg/School/Vaccination/vaccine_frontend/node_modules/nft.storage/dist/src/lib.cjs.

alanshaw commented 2 years ago

We've not tested the client in react native. Could be that it is not supporting package.json exports properly. Please send us a pull request if you figure this one out!

LeslieOA commented 2 years ago

@prajwolrg Please see https://github.com/web3-storage/web3.storage/issues/957#issuecomment-1036338120

prajwolrg commented 2 years ago

@LeslieOA Glad for the help. I tried the solution but it creates more problems than solutions in my case.