Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Error [ERR_MODULE_NOT_FOUND] importing { Metaplex } from "@metaplex-foundation/js-next" #63

Answered by lorisleiva
katewayo asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks again for providing the steps to reproduce this issue. I've been able to make it work using an express app.

Since express apps use "CommonJS", we need to use require to import libraries (as you do to import express in the first place). That means you need to make the following change in your index.js file and it will work as expected.

- import { Metaplex } from '@metaplex-foundation/js-next';
+ const { Metaplex } = require('@metaplex-foundation/js-next');

Here's a quick example of how to fetch an NFT using its mint address on an express app. Note that you'll first need to install web3.js using npm install @solana/web3.js.

const express = require('express')
const app = express()
const 

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@katewayo
Comment options

@lorisleiva
Comment options

@katewayo
Comment options

@lorisleiva
Comment options

Comment options

You must be logged in to vote
2 replies
@katewayo
Comment options

@lorisleiva
Comment options

Answer selected by lorisleiva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants