You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to error message: Can't resolve 'encoding' for npm package.
To Reproduce
see below code:
// USING NEXTJS@13// ./src/app/page.tsximportReact,{useEffect,useState}from"react";importImagefrom"next/image";import{FetchNFTClient}from"@audius/fetch-nft";importNFTfrom"./NFT";// FETCH - TESTING OUT FETCH APIasyncfunctiongetPuppers(){constresponse=awaitfetch("https://dog.ceo/api/breeds/image/random",{cache: "no-cache",});constdata=awaitresponse.json();returndata;}// NFT// upon checking Opensea the address: GrWNH9qfwrvoCEoTm65hmnSh4z3CD96SfhtfQY6ZKUfY// doesn't yield anything.// Where is this data being pulled from?// GETTING ISSUES WITH APIasyncfunctiongetSolanaCollectibles(){// Initialize fetch clientconstfetchClient=newFetchNFTClient();// Fetching Solana collectibles for the given walletsreturnfetchClient.getSolanaCollectibles(["GrWNH9qfwrvoCEoTm65hmnSh4z3CD96SfhtfQY6ZKUfY"]).then(({ res })=>{returnres;});}// TESTING OUT OPENSEA API since Fetch-API is causing issues for setupasyncfunctiongetEthereumCollectibles(){constsdk=require("api")("@opensea/v2.0#1nqh2zlnvr1o4h");sdk.auth("04c8ae776ac44b4cabebbed161dfbc8c");sdk.server("https://api.opensea.io");returnawaitsdk.list_nfts_by_account({chain: "ethereum",address: "0x5A8443f456f490dceeAD0922B0Cc89AFd598cec9",}).then(({ data })=>{returndata;}).catch((err)=>console.error(err));}exportdefaultasyncfunctionHome(){constdogs=awaitgetPuppers();console.log(dogs);letethAssets;constgetEthData=awaitgetEthereumCollectibles().then((res)=>{ethAssets=res;// get base objectconsole.log("WORKING DATA:",ethAssets);console.log("DATA 1:",ethAssets.nfts[0]);});letsolAssets;constgetSolData=awaitgetSolanaCollectibles().then((res)=>{solAssets=res;// get base objectconsole.log("WORKING DATA:",solAssets);});return(<div><h1>Audius Data</h1><NFTdata={ethAssets.nfts}/><h1>Doggos Data</h1><Imagesrc={dogs.message}width={500}height={500}alt="doggos"priority/></div>);}
Supporting Media
⚠ ./node_modules/@audius/fetch-nft/dist/index.js
Module not found: Can't resolve 'encoding' in '/Users/anthonyalbertorio/Desktop/audius-nft/audius-nft/node_modules/@audius/fetch-nft/dist'Import trace for requested module:./node_modules/@audius/fetch-nft/dist/index.js./src/app/page.tsx./node_modules/node-fetch/lib/index.jsModule not found: Can't resolve 'encoding'in'/Users/anthonyalbertorio/Desktop/audius-nft/audius-nft/node_modules/node-fetch/lib'
Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/@solana/web3.js/lib/index.cjs.js
./node_modules/@audius/fetch-nft/dist/index.js
./src/app/page.tsx
⚠ ./node_modules/@audius/fetch-nft/dist/index.js
Module not found: Can't resolve 'encoding' in '/Users/anthonyalbertorio/Desktop/audius-nft/audius-nft/node_modules/@audius/fetch-nft/dist'Import trace for requested module:./node_modules/@audius/fetch-nft/dist/index.js./src/app/page.tsx./node_modules/node-fetch/lib/index.jsModule not found: Can't resolve 'encoding'in'/Users/anthonyalbertorio/Desktop/audius-nft/audius-nft/node_modules/node-fetch/lib'
Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/isomorphic-fetch/fetch-npm-node.js
./node_modules/api/dist/cache.js
./node_modules/api/dist/index.js
./src/app/page.tsx
Expected behavior
Expected to see Solana data upon running npm run dev.
Describe the bug
According to error message:
Can't resolve 'encoding'
for npm package.To Reproduce
see below code:
Supporting Media
Expected behavior
Expected to see Solana data upon running
npm run dev
.Your environment
Dev Environment
OS
OS: MacOS 13.4 - Ventura
NextJS: 13
Node version: V20.5.0
Npm version: 9.8.1
Browser name and version: Chrome 118.0.5993.70
Additional context:
The text was updated successfully, but these errors were encountered: