Next.js Discord

Discord Forum

Working through Next JS Learn Tutorial, ACME Dashboard, "Critical Dependency Error"

Unanswered
Devon Rex posted this in #help-forum
Open in Discord
Devon RexOP
I'm learning Next JS, on this part of the official tutorial:

https://nextjs.org/learn/dashboard-app/fetching-data

When I import the fetchRevenue function on my dashboard page I get this in the terminal.

Import trace for requested module:
./node_modules/node-gyp-build/index.js
./node_modules/bufferutil/index.js
./node_modules/ws/lib/buffer-util.js
./node_modules/ws/lib/receiver.js
./node_modules/ws/wrapper.mjs
./node_modules/@vercel/postgres/dist/index-node.js
./app/lib/data.ts
./app/dashboard/page.tsx
 âš  ./node_modules/node-gyp-build/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted


Is there anything wrong with this import statement? import { fetchRevenue } from '@/app/lib/data';

The other functions, fetchCardData, fetchInvoiceTotal etc. seem to work (see picture).

Thank you

1 Reply

Devon RexOP
Ok, so I've solved this for myself, kind of. I saw the error message in the terminal and presumed there was something wrong with querying my database, or my dev environment, or missing something installed on my system i.e. python. It was just a matter of the RevenueChart component's code being all commented out.

It might be worth updating the tutorial to include the instruction, uncomment the code in the component.