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
618 stars 167 forks source link

Cant resolve ipfs-car/blockstore/memory when importing nft.storage #1086

Closed Josiassejod1 closed 2 years ago

Josiassejod1 commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch nft.storage@5.2.0 for the project I'm working on. I got this error while working on uploading my file to vercel

https://stackoverflow.com/questions/57867267/how-to-update-package-lock-json-without-doing-npm-install followed this example

Here is the diff that solved my problem:

diff --git a/node_modules/nft.storage/src/lib.js b/node_modules/nft.storage/src/lib.js
index 035f589..fc4cbd4 100644
--- a/node_modules/nft.storage/src/lib.js
+++ b/node_modules/nft.storage/src/lib.js
@@ -17,7 +17,7 @@
 import { transform } from 'streaming-iterables'
 import pRetry, { AbortError } from 'p-retry'
 import { TreewalkCarSplitter } from 'carbites/treewalk'
-import { pack } from 'ipfs-car/pack'
+import { pack } from 'ipfs-car/dist/esm/pack'
 import { CID } from 'multiformats/cid'
 import * as Token from './token.js'
 import { fetch, File, Blob, FormData, Blockstore } from './platform.js'
diff --git a/node_modules/nft.storage/src/platform.web.js b/node_modules/nft.storage/src/platform.web.js
index 63f4d0a..d13422a 100644
--- a/node_modules/nft.storage/src/platform.web.js
+++ b/node_modules/nft.storage/src/platform.web.js
@@ -1,4 +1,4 @@
-import { MemoryBlockStore } from 'ipfs-car/blockstore/memory'
+import { MemoryBlockStore } from 'ipfs-car/dist/esm/blockstore/memory'

 export const fetch = globalThis.fetch
 export const FormData = globalThis.FormData
diff --git a/node_modules/nft.storage/src/token.js b/node_modules/nft.storage/src/token.js
index 62f80ad..d93fbcb 100644
--- a/node_modules/nft.storage/src/token.js
+++ b/node_modules/nft.storage/src/token.js
@@ -1,4 +1,4 @@
-import { pack } from 'ipfs-car/pack'
+import { pack } from 'ipfs-car/dist/esm/pack'
 import { CID } from 'multiformats/cid'
 import * as Block from 'multiformats/block'
 import { sha256 } from 'multiformats/hashes/sha2'

This issue body was partially generated by patch-package.

alanshaw commented 2 years ago

Hi, please see the solution to this issue here: https://github.com/nftstorage/nft.storage/issues/876#issuecomment-985687135

Josiassejod1 commented 2 years ago

Hi, please see the solution to this issue here: https://github.com/nftstorage/nft.storage/issues/876#issuecomment-985687135

Thanks !