nft.storage icon indicating copy to clipboard operation
nft.storage copied to clipboard

Module not found: Can't resolve 'ipfs-car/blockstore/memory'

Open adaOctopus opened this issue 5 years ago • 1 comments

Hi! I am trying to install the nft.storage library to store my nft metadata to ipfs. I use Reactjs, and when I do npm start, I get this error image

Searched online, and looks like a webpack version problem. Did all the upgrade process from v4 to v5 webpack, still getting the same error.

This is my package.json file: { "name": "web3-tutorial", "version": "0.1.0", "private": true, "dependencies": { "@openzeppelin/contracts": "^4.3.2", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^11.2.7", "@testing-library/user-event": "^12.8.3", "contracts": "file:./truffle/build/contracts", "dotenv": "^10.0.0", "ipfs-http-client": "^53.0.1", "nft.storage": "^4.0.1", "react": "^17.0.0", "react-dom": "^17.0.0", "react-scripts": "^4.0.0", "truffle-hdwallet-provider": "^1.0.17", "web-vitals": "^1.1.2", "web3": "^1.6.0" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } Can you please help me out? What config do I need to change to make this work? When webpack is 4.44.2 it does not resolve, and when I do the process of upgrading, webpack 5 is not there and still getting same error.

adaOctopus avatar Nov 22 '21 18:11 adaOctopus

I would remove the post, but looks like a lot of people face it. I finally resolved it. The issue is, that once you npm install, and install ipfs-car, the library itself (ipfs-car) has changed its structure. Therefore u need to update the following inside the nft.storage folder inside the node_modules of your root project: 1){ ipfs-car/dist/esm/blockstore/memory} inside the platform.web.js file 2) {ipfs-car/dist/esm/pack} inside the lib.js file 3) ipfs-car/dist/esm/pack inside the token.js file

And then the error should be resolved and library works perfectly fine.

adaOctopus avatar Nov 22 '21 18:11 adaOctopus