Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found from fresh install #36939

Closed
1 task done
tomasbruckner opened this issue May 16, 2022 · 6 comments
Closed
1 task done

Module not found from fresh install #36939

tomasbruckner opened this issue May 16, 2022 · 6 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@tomasbruckner
Copy link

Verify canary release

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

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
Binaries:
  Node: 16.14.2
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 12.1.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? (if relevant)

No response

Describe the Bug

Freshly installed Next.js app throws error MODULE_NOT_FOUND

Expected Behavior

The application works

To Reproduce

  1. Run npx create-next-app@latest
What is your project named? ... nextdeletejs
Creating a new Next.js app in C:\.....\nextdeletejs.

Using npm.

Installing dependencies:
- react
- react-dom
- next


added 14 packages, and audited 15 packages in 2s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Installing devDependencies:
- eslint
- eslint-config-next


added 208 packages, and audited 223 packages in 4s

68 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Initialized a git repository.

Success! Created nextdeletejs at C:\....\nextdeletejs
Inside that directory, you can run several commands:

  npm run dev
    Starts the development server.

  npm run build
    Builds the app for production.

  npm start
    Runs the built app in production mode.

We suggest that you begin by typing:

  cd nextdeletejs
  npm run dev
  1. cd nextdeletejs/
  2. npm run dev
> next dev

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
wait  - compiling...
error - ./node_modules/next/dist/client/dev/amp-dev.js
Module not found: Can't resolve 'C:\...\nextdeletejs\node_modules\next\dist\compiled\regenerator-runtime\runtime.js' in 'C:\...\ud4d\nextdeletejs\node_modules\next\dist\client\dev'
  1. When I try to go to localhost:3000
wait  - compiling /_error (client and server)...
wait  - compiling...
error - ./node_modules/next/dist/client/dev/amp-dev.js
Module not found: Can't resolve 'C:\....\nextdeletejs\node_modules\next\dist\compiled\regenerator-runtime\runtime.js' in 'C:\...\nextdeletejs\node_modules\next\dist\client\dev'
error - Error: Cannot find module 'C:\...\nextdeletejs\.next\fallback-build-manifest.json'
Require stack:
- C:\...\nextdeletejs\node_modules\next\dist\server\load-components.js
- C:\...\nextdeletejs\node_modules\next\dist\server\next-server.js
- C:\...\nextdeletejs\node_modules\next\dist\server\next.js
- C:\...\nextdeletejs\node_modules\next\dist\server\lib\start-server.js
- C:\...\nextdeletejs\node_modules\next\dist\cli\next-dev.js
- C:\...\nextdeletejs\node_modules\next\dist\bin\next
Error: Cannot find module 'C:\...\nextdeletejs\.next\fallback-build-manifest.json'
Require stack:
- C:\...\nextdeletejs\node_modules\next\dist\server\load-components.js
- C:\...\nextdeletejs\node_modules\next\dist\server\next-server.js
- C:\...\nextdeletejs\node_modules\next\dist\server\next.js
- C:\...\nextdeletejs\node_modules\next\dist\server\lib\start-server.js
- C:\...\nextdeletejs\node_modules\next\dist\cli\next-dev.js
- C:\...\nextdeletejs\node_modules\next\dist\bin\next
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.mod._resolveFilename (C:\...\nextdeletejs\node_modules\next\dist\build\webpack\require-hook.js:183:28)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.loadDefaultErrorComponents (C:\...\nextdeletejs\node_modules\next\dist\server\load-components.js:22:24)
    at DevServer.getFallbackErrorComponents (C:\...\nextdeletejs\node_modules\next\dist\server\dev\next-dev-server.js:696:43)
    at async DevServer.renderErrorToResponse (C:\...\nextdeletejs\node_modules\next\dist\server\base-server.js:1224:40)
    at async pipe.req.req (C:\...\nextdeletejs\node_modules\next\dist\server\base-server.js:1168:30)
    at async DevServer.pipe (C:\...\nextdeletejs\node_modules\next\dist\server\base-server.js:628:25) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\...\\nextdeletejs\\node_modules\\next\\dist\\server\\load-components.js',
    'C:\\...\\nextdeletejs\\node_modules\\next\\dist\\server\\next-server.js',
    'C:\\...\\nextdeletejs\\node_modules\\next\\dist\\server\\next.js',
    'C:\\...\\nextdeletejs\\node_modules\\next\\dist\\server\\lib\\start-server.js',
    'C:\\...\\nextdeletejs\\node_modules\\next\\dist\\cli\\next-dev.js',
    'C:\\...\\nextdeletejs\\node_modules\\next\\dist\\bin\\next'
  ]
}
@tomasbruckner tomasbruckner added the bug Issue was opened via the bug report template. label May 16, 2022
@tomasbruckner
Copy link
Author

Ok, so I investigated a little more and this error occurs if I have folder

~/workspace/foo/test

but when the folder is

~/workspace/test

it works fine.

In the first case, it cannot resolve the path

'C:\Users\tomas\workspacefoo\test\node_modules\next\dist\compiled\regenerator-runtime\runtime.js'

For some reason there is a missing slash in workspace and foo!

@NicolasMarafetti
Copy link

Hello, I had the same problem and I confirm this can occur because of folder names.
But this is not specific to "workspace" or "foo".

Working at - D:\Programmation\Udemy\nextjs\cours-nextjs
Not working at - D:\Programmation\Udemy\udemy\cours-nextjs

@tomasbruckner
Copy link
Author

it looks like duplicate of #36078

@arcreigh
Copy link

arcreigh commented Nov 19, 2022

Looks like this also occurs when the drive is a network share. similar behavior where npm is unable to find amp-dev causing the build to fail. My directories did not have ud in the name which is what #36078 seems to apply to. I think there is a much bigger problem here then just directory names.

@samcx
Copy link
Member

samcx commented Feb 28, 2024

Hi everyone,

I was not able to replicate this in the latest, and it is unlikely this is still an issue.

I will be closing this issue in the meantime!

@samcx samcx closed this as completed Feb 28, 2024
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

4 participants