GithubHelp home page GithubHelp logo

Comments (5)

jakerainis avatar jakerainis commented on August 19, 2024 2

@naftalimurgor Yeah, it was puzzling to me as well. In any case, I was able to find a workaround and hopefully this works for you as well. Instead of using this library, I've removed it an am now just using the NFT Storage API. Before, I was doing something like this:

const cid = await client.storeBlob(new Blob([file]))

Now I'm doing this:

const { body } = await got.post('https://api.nft.storage/upload', {
      headers: { Authorization: `Bearer ${YOUR_API_KEY}` },
      body: file,
})
const cid = JSON.parse(body).value.cid

Note: I'm using got as my HTTP library, but you can use node-fetch, Axios, or whatever http tooling you prefer.

Hope this helps!

from carbites.

alanshaw avatar alanshaw commented on August 19, 2024 2

In other cases we've found the problem to be because the library is being bundled with webpack 4.

Webpack 4 does not support package.json exports field so is unable to resolve the dependency.

If you can't upgrade to webpack 5, you can use the prebuilt library:

import { NFTStorage } from 'nft.storage/dist/bundle.esm.min.js'

from carbites.

naftalimurgor avatar naftalimurgor commented on August 19, 2024 1

Wow, thanks for the insight. Let me try to using that approach. Will let you know in case of any issues.

from carbites.

jakerainis avatar jakerainis commented on August 19, 2024

My team is also running into this issue as well (node@16), which I believe is because carbites is an ESM-only library. Our build can't resolve the module.

from carbites.

naftalimurgor avatar naftalimurgor commented on August 19, 2024

@jakerainis At first I thought it was a problem a problem with Nodejs version. Has your team been able to upload the NFT artifacts using any other means? I'm looking to upload over 1200 images but can't seem to wrap my head around this issue yet.

from carbites.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.