Next.js developers encounter errors with module imports
11 posts since May 2022, all from GitHub.
“Problems 1. Lint is broken. Next 16 removed next lint . npm run lint now fails with: There's also no ESLint config file, and eslint config next is pinned to 15.4.6 while next is ^16.3.6 . Move to the ESLint CLI with a flat config ( eslint.config.mjs ) and match eslint config…”
“Problem There are several ESLint issues. 1. Incorrect configuration filename scaffold.ts writes: but the contents are eslintrc style: ESLint 8 uses eslintrc by default and expects .eslintrc. . 2. Interactive prompt With no config detected, next lint can enter an interactive…”
“What happens npm run lint ( next lint ) fails immediately: Invalid project directory provided, no such directory: lint . Running eslint . directly instead fails with a different error: ESLint 9.26.0 can't find eslint.config.js — the repo only has the legacy .eslintrc.json . What…”
Developers upgrading to Next.js v15 or using turbopack are experiencing issues importing modules like 'Image' and 'Metadata'. This prevents them from utilizing core features and requires disabling turbopack for functionality.
SOURCES (11)
“npm run lint runs next lint , which Next.js 16 removed. It errors with Invalid project directory ... /lint . Fix: move to the ESLint CLI with a flat config ( eslint.config.mjs using eslint config next ), change the script to eslint . , and…”
“frontend/package.json declares "lint": "next lint" , but this project is on Next 16.4.3, where the next lint subcommand no longer exists. Running it fails before doing any work: next help confirms there is no lint subcommand. So the lint gate simply does not run, even though rules.md §2 says to keep the frontend consistent. Proposal Replace the script with a working linter. The lightest option that satisfies Next 16 is ESLint via the flat config ( eslint.config.mjs ) plus eslint config next , wi”
“Problems 1. Lint is broken. Next 16 removed next lint . npm run lint now fails with: There's also no ESLint config file, and eslint config next is pinned to 15.4.6 while next is ^16.3.6 . Move to the ESLint CLI with a flat config ( eslint.config.mjs ) and match eslint config next to the Next major. 2. Type mismatch. react / react dom are 19 but @types/react / @types/react dom are ^18 . 3. Type checking is mostly off. tsconfig.json has "strict": false , and Navbar / DataTable props are untyped (i”
“Problem There are several ESLint issues. 1. Incorrect configuration filename scaffold.ts writes: but the contents are eslintrc style: ESLint 8 uses eslintrc by default and expects .eslintrc. . 2. Interactive prompt With no config detected, next lint can enter an interactive prompt, causing: to hang in non TTY environments. 3. Missing eslint config next @repo/eslint config/next extends: which requires eslint config next . It is not included in the generated project. 4. Server and UI are not actua”
“What happens npm run lint ( next lint ) fails immediately: Invalid project directory provided, no such directory: lint . Running eslint . directly instead fails with a different error: ESLint 9.26.0 can't find eslint.config.js — the repo only has the legacy .eslintrc.json . What should happen npm run lint runs ESLint against the project and reports real findings. How to reproduce 1. npm ci legacy peer deps 2. npm run lint Where Found while working 171 on next (Next.js 16.2.12, ESLint 9.26.0 inst”
“Link to the code that reproduces this issue https://codesandbox.io/p/devbox/damp sea q85m6v To Reproduce npm run lint Current vs. Expected behavior Error [ERR PACKAGE PATH NOT EXPORTED]: No "exports" main defined in /project/sandbox/node modules/some package/package.json imported from /project/sandbox/next.config.mjs It should be possible to lint a project without a package being used as a plugin in the next config being built. In monorepo pipelines it's common to lint prior to building all depe”
“Link to the code that reproduces this issue https://github.com/nextui org/next app template To Reproduce 1. Upgrade to v15 from v14 2. Enable turbopack 3. start dev server using typescript Current vs. Expected behavior Expected behevior Import stuff (like Image, Metadata) from next package Currently you can't Though you can: ( Fix ) 1. Disable turbopack 2. start dev server Provide environment information Which area(s) are affected? (Select all that apply) Module Resolution Which stage(s) are aff”
“Link to the code that reproduces this issue https://github.com/AvishakeAdhikary/blog To Reproduce 1. Upgrade to Next.js 15.0.1. 2. Run npm run dev in the project directory. 3. Observe the error regarding the favicon processing. Current vs. Expected behavior Current Behavior: When running the development server, the following error occurs: Screenshot 2024 10 25 004235 Expected Behavior: The favicon should load without errors, allowing the application to start correctly. Provide environment inform”
“Link to the code that reproduces this issue https://github.com/ysulyma/eslint config next repro To Reproduce 1. Clone the repository 2. Run the following The error only happens when using next/core web vitals , not when using the default TypeScript lint settings. Current vs. Expected behavior I expected index.tsx to lint without issue, but with the Next plugin I'm receiving the error Provide environment information Which area(s) are affected? (Select all that apply) ESLint (eslint config next) W”
“I'm trying to publish a component library that Next.js users can use individual components from without having to worry about bundle size overhead. Since Next.js [doesn't tree shake the root import][1], as a library author, I have to provide deep imports to the individual components as a workaround. But the build command fails for deep imports. Verify canary release [X] I verified that the issue exists in the latest Next.js canary release Provide environment information Operating System: Platfor”
“Verify canary release [X] I verified that the issue exists in Next.js canary release Provide environment information Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu 8020.101.4 15/RELEASE ARM64 T6000 Binaries: Node: 16.13.1 npm: 8.1.2 Yarn: 1.22.17 pnpm: N/A Relevant packages: next: 12.1.7 canary.6 react: 18.1.0 react dom: 18.1.0 What browser are you using? (if relevant) No response How are you deploying your application?”
