next.js: [NEXT-853] Running development mode on fresh create-next-app not working

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 Binaries: Node: 18.13.0 npm: 8.19.3 Yarn: N/A pnpm: N/A Relevant packages: next: 13.1.6 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

CLI (create-next-app)

Link to the code that reproduces this issue

N/A

To Reproduce

Run npm run dev from root directory of project.

Package.json:

{
  "name": "next-base",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@next/font": "13.1.6",
    "next": "13.1.6",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  }
}

Describe the Bug

When running npm run dev on a fresh create-next-app, the dev server is not starting, no errors are logged in the terminal - it just kills the command and shows the terminal cursor again. Localhost is not being used by another application.

Expected Behavior

Dev server to spin up in localhost:3000.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-853

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 3
  • Comments: 23 (4 by maintainers)

Most upvoted comments

Can confirm this issue still exists in nextjs 13.2.4. So installed nextjs 13.0.0 as per suggestion. My current dependencies look like this: image

However downgrading to version 13 introduces another problem. image Removing instances of next/font removes the error but this is not a proper solution.

UPDATE: Instead of downgrading nextjs, I downgraded installed node to 16.9.1 and now it’s working with latest nextjs 13.2.4. However, again this is not a solution either.

+1 looks like I’m having the same issue. My repo was working perfectly on windows, but can’t get the dev server to start up on Mac.

on next:^13.2.1 getting error: TypeError: Cannot read properties of undefined (reading ‘ProvidePlugin’) while building custom dev server. Production environment works fine. next:^13.0.1 does not have this issue. Please fix.

When I run on 13.0.0 I see: image

in next/dist/server/config.js

When I run on canary 13.1.7-11 I see: image

The error I ultimately get on canary is:

Failed to start next js server TypeError: Cannot read properties of undefined (reading ‘ProvidePlugin’) at Object.getBaseWebpackConfig [as default] (\node_modules\next\src\build\webpack-config.ts:2019:21) at async Promise.all (index 0) at Span.traceAsyncFn (\node_modules\next\src\trace\trace.ts:106:14) at Span.traceAsyncFn (\node_modules\next\src\trace\trace.ts:106:14) at HotReloader.start (\node_modules\next\src\server\dev\hot-reloader.ts:584:26) at DevServer.prepare (\node_modules\next\src\server\dev\next-dev-server.ts:731:5) at ViewService.createServer (\src\server\view\view.service.ts:21:9) at bootstrap (\src\server\main.ts:77:5) {stack: ‘TypeError: Cannot read properties of undefined…\src\server\main.ts:77:5)’, message: ‘Cannot read properties of undefined (reading ‘ProvidePlugin’)’}

If the loadWebpackHook this doesn’t happen for me, I remove the conditional load and the server starts fine for me.

Looks like this commit introduced this condition: https://github.com/vercel/next.js/commit/aa0664cc2c0415fbe851a0e2aa9dd932bc9327e9 Any reason why this is needed?

This only happens for me when I run the next js server in dev mode, when I build out my production build it runs fine

Can confirm next@canary still experiences the same issue. @balazsorban44