ipfs / helia

An implementation of IPFS in JavaScript
https://helia.io
Other
916 stars 95 forks source link

Missing 'default' export in 'module node_modules/node-domexception/index.js' #428

Closed LouiFi closed 7 months ago

LouiFi commented 7 months ago

Hi,

I was just trying to perform the json example :

index.ts

import { createHelia } from 'helia'
import { json } from '@helia/json'

const helia = await createHelia()
const j = json(helia)

const myImmutableAddress = await j.add({ hello: 'world' })

console.log(await j.get(myImmutableAddress))

bun add @helia/json bun run index.ts

1 | (function (entry, fetcher)
                        ^
SyntaxError: Missing 'default' export in module '/Users/username/project-folder/node_modules/node-domexception/index.js'.
      at link (:1:21)
      at link (:1:21)
      at link (:1:21)
      at link (:1:21)
      at link (:1:21)
      at link (:1:21)
      at link (:1:21)
      at link (:1:21)
      at link (:1:21)
      at linkAndEvaluateModule (:1:21)

When using node v20.11.0 (npm v10.2.4)

It's seems the certificate has expired when 'npm i helia'

npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/helia failed, reason: certificate has expired

npm ERR! A complete log of this run can be found in: /Users/louis_dauvergne/.npm/_logs/2024-02-10T18_47_32_186Z-debug-0.log

Is this something wrong with bun, certificate or node-domexception package ?

Thanks for helping

achingbrain commented 7 months ago
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/helia failed, reason: certificate has expired

This is the certificate of the registry at https://registry.npm.taobao.org - this is not the default registry which is https://registry.npmjs.org so you've overridden it in your config at some point.

Please can you try with the default registry.

SyntaxError: Missing 'default' export in module`

What happens when you run this with the latest node and not bun?

LouiFi commented 7 months ago

Thank you it's working like a charm with node --lts (without bun 😢 🐇)

I did not expect any PR related to bun so I will go back with tsc so !

achingbrain commented 7 months ago

There's a work-in-progress example PR for running with bun - we're waiting for a few dependencies to update, notably bun itself to support Windows.

Keep an eye on this, it should start working soon - https://github.com/ipfs-examples/helia-examples/pull/101