question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[12.0.4-canary.2], Preact - Local dev server fails with Error: Cannot find module 'scheduler/package.json'

See original GitHub issue

What version of Next.js are you using?

12.0.4-canaray.2 to 12.0.4-canaray.4

What version of Node.js are you using?

14.17.6

What browser are you using?

chrome

What operating system are you using?

macOS

How are you deploying your application?

.

Describe the Bug

Local dev server stops with an error: Error: Cannot find module 'scheduler/package.json'.

I assume this comes in relation with the recent changes in this line in webocket-config.js.

I believe we scheduler must be removed from topLevelFrameworkPaths to make it work correctly.

Complete error:

Error: Cannot find module 'scheduler/package.json'
Require stack:
- /Users/<path>/node_modules/next/dist/build/webpack-config.js
- /Users/<path>/node_modules/next/dist/server/dev/hot-reloader.js
- /Users/<path>/node_modules/next/dist/server/dev/next-dev-server.js
- /Users/<path>/node_modules/next/dist/server/next.js
- /Users/<path>/node_modules/next/dist/server/lib/start-server.js
- /Users/<path>/node_modules/next/dist/cli/next-dev.js
- /Users/<path>/node_modules/next/dist/bin/next
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.mod._resolveFilename (/Users//<path>/node_modules/next/dist/build/webpack/require-hook.js:171:28)
    at Function.resolve (internal/modules/cjs/helpers.js:98:19)
    at getPackagePath (/Users/<path>/node_modules/next/dist/build/webpack-config.js:601:41)
    at Object.getBaseWebpackConfig [as default] (/Users/<path>/node_modules/next/dist/build/webpack-config.js:619:9)
    at async Promise.all (index 0)
    at async Span.traceAsyncFn (/Users/<path>/node_modules/next/dist/trace/trace.js:74:20)
    at async Span.traceAsyncFn (/Users/<path>/node_modules/next/dist/trace/trace.js:74:20)
    at async HotReloader.start (/Users/n<path>/node_modules/next/dist/server/dev/hot-reloader.js:325:25)
    at async DevServer.prepare (/Users/<path>/node_modules/next/dist/server/dev/next-dev-server.js:290:9) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/<path>/node_modules/next/dist/build/webpack-config.js',
    '/Users/<path>/node_modules/next/dist/server/dev/hot-reloader.js',
    '/Users<path>/node_modules/next/dist/server/dev/next-dev-server.js',
    '/Users/<path>/node_modules/next/dist/server/next.js',
    '/Users/<path>/node_modules/next/dist/server/lib/start-server.js',
    '/Users/<path>/node_modules/next/dist/cli/next-dev.js',
    '/Users/<path>p/node_modules/next/dist/bin/next'
  ]
}

To Reproduce

Package manager: yarn dependencies:

"dependencies": {
    "next": "12.0.4-canary.2",
    "preact": "^10.5.13",
    "preact-render-to-string": "^5.1.19",
    "react": "npm:@preact/compat@^0.0.4",
    "react-dom": "npm:@preact/compat@^0.0.4"
  },

Upgrade next.js to version >= 12.0.4-canary.2.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:18
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

8reactions
bcheidemanncommented, Dec 12, 2021

I have the same issue. My workaround until this is fixed is installing scheduler with npm install scheduler.

6reactions
ijjkcommented, Feb 7, 2022

Hi, this has been updated in v12.0.11-canary.7 of Next.js, please update and give it a try!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module - webpack-dev-server.js
I run into the same issue above. You can try the following: "scripts": { "start": "webpack-dev-server --open --hot", "build": ".
Read more >
cannot find module '...' or its corresponding type declarations
I've been trying to deploy my nextjs app on Vercel, but got "Type error: cannot find module '...' or its corresponding type declarations" ......
Read more >
Cannot find module 'react/package.json' #17448 - Issuehunt
Storybook build fails in CI environment with error Error: Cannot find module 'react/package.json' #17448. shamprasadrh posted onGitHub. Describe the bug.
Read more >
Error: Cannot find module '@medic/contact-types-utils'
I'm trying to run “node server.js” in my cht project/api but I got error: ERROR: UNHANDLED REJECTION! ERROR: Reason: Error: Cannot find ......
Read more >
cannot find module 'formik' or its corresponding type ...
import { Field } from "formik";. On my machine (Windows) it builds fine. Because of the different OS or settings, Vercel was failing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found