web3-storage / web3.storage

DEPRECATED ⁂ The simple file storage service for IPFS & Filecoin
https://web3.storage
Other
500 stars 124 forks source link

Out of the box Bug. Module not found: Error: Can't resolve 'process/browser' #1923

Open Le4kno3 opened 1 year ago

Le4kno3 commented 1 year ago

Hi,

Today I came to know about web3.storage and wanted to test a file upload feature to store the date in IPFS. But out of the box, after calling the library using my react app I go the below error.

Failed to compile.

Module not found: Error: Can't resolve 'process/browser' in '/home/user/Documents/Github/App-Frontend/node_modules/streaming-iterables/dist'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
ERROR in ./node_modules/streaming-iterables/dist/index.mjs 929:18-25
Module not found: Error: Can't resolve 'process/browser' in '/home/user/Documents/Github/App-rontend/node_modules/streaming-iterables/dist'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/streaming-iterables/dist/index.mjs
Cannot read properties of undefined (reading 'module')

webpack compiled with 2 errors

Any resolution or workaround will be heart fully appreciated. Thanks!

jacekv commented 1 year ago

I am having the same issue. Import works fine, but as soon I am trying to create an object with:

const web3StorageClient = new Web3Storage({ token : web3Token });

I get the error.

jacekv commented 1 year ago

I assume that this library should not be used in a frontend? After checking the docs again docs I saw that nodejs is a minimum requirement.