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

Unable to run next on canary branch: Cannot find module './polyfills/polyfill-nomodule' #40334

Closed
1 task done
zxti opened this issue Sep 7, 2022 · 2 comments · Fixed by #40335
Closed
1 task done
Labels
Developer Experience Issues related to Next.js logs, Error overlay, etc.

Comments

@zxti
Copy link

zxti commented Sep 7, 2022

Verify canary release

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

Provide environment information

Tried on 3 different platforms: Linux x86_64, MacOS arm64, and MacOS x86_64. Tried also with different nodejs versions from 14 through 18.

A few example environments:

$ pnpm next info

> nextjs-project@0.0.0 next /home/ubuntu/next.js
> node --trace-deprecation --enable-source-maps packages/next/dist/bin/next "info"


    Operating System:
      Platform: linux
      Arch: x64
      Version: #76~18.04.1-Ubuntu SMP Mon Mar 28 17:49:57 UTC 2022
    Binaries:
      Node: 16.17.0
      npm: 8.15.0
      Yarn: 1.22.19
      pnpm: 7.3.0
    Relevant packages:
      next: 12.2.6-canary.11
      eslint-config-next: 12.2.6-canary.11
      react: 18.2.0
      react-dom: 18.2.0
    Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.8.0
      npm: 8.18.0
      Yarn: 1.22.19
      pnpm: 7.3.0
    Relevant packages:
      next: 12.2.6-canary.11
      eslint-config-next: 12.2.6-canary.11
      react: 18.2.0
      react-dom: 18.2.0
    Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64
    Binaries:
      Node: 16.17.0
      npm: 8.15.0
      Yarn: 1.22.19
      pnpm: 7.3.0
    Relevant packages:
      next: 12.2.6-canary.11
      eslint-config-next: 12.2.6-canary.11
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Running any example or test fails, cannot find polyfill-nomodule.

$ pnpm next examples/hello-world/

> nextjs-project@0.0.0 next /home/ubuntu/next.js
> node --trace-deprecation --enable-source-maps packages/next/dist/bin/next "examples/hello-world/"

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Using locally built binary of @next/swc
Error: Cannot find module './polyfills/polyfill-nomodule'
Require stack:
- /home/ubuntu/next.js/packages/next/dist/build/webpack-config.js
- /home/ubuntu/next.js/packages/next/dist/server/dev/hot-reloader.js
- /home/ubuntu/next.js/packages/next/dist/server/dev/next-dev-server.js
- /home/ubuntu/next.js/packages/next/dist/server/next.js
- /home/ubuntu/next.js/packages/next/dist/server/lib/start-server.js
- /home/ubuntu/next.js/packages/next/dist/cli/next-dev.js
- /home/ubuntu/next.js/packages/next/dist/lib/commands.js
- /home/ubuntu/next.js/packages/next/dist/bin/next
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at call (/home/ubuntu/next.js/packages/next/build/webpack/require-hook.ts:25:28)
    at call (/home/ubuntu/next.js/packages/next/build/webpack/require-hook.ts:25:28)
    at Function.mod._resolveFilename (/home/ubuntu/next.js/packages/next/build/webpack/require-hook.ts:25:28)
    at Function.resolve (node:internal/modules/cjs/helpers:108:19)
    at Object.getBaseWebpackConfig (/home/ubuntu/next.js/packages/next/build/webpack-config.ts:1778:29)
    at async Promise.all (index 0)
    at Span.traceAsyncFn (/home/ubuntu/next.js/packages/next/trace/trace.ts:106:14)
    at Span.traceAsyncFn (/home/ubuntu/next.js/packages/next/trace/trace.ts:106:14)
    at HotReloader.start (/home/ubuntu/next.js/packages/next/server/dev/hot-reloader.ts:559:26) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/ubuntu/next.js/packages/next/dist/build/webpack-config.js',
    '/home/ubuntu/next.js/packages/next/dist/server/dev/hot-reloader.js',
    '/home/ubuntu/next.js/packages/next/dist/server/dev/next-dev-server.js',
    '/home/ubuntu/next.js/packages/next/dist/server/next.js',
    '/home/ubuntu/next.js/packages/next/dist/server/lib/start-server.js',
    '/home/ubuntu/next.js/packages/next/dist/cli/next-dev.js',
    '/home/ubuntu/next.js/packages/next/dist/lib/commands.js',
    '/home/ubuntu/next.js/packages/next/dist/bin/next'
  ]
}
 ELIFECYCLE  Command failed with exit code 1.

Expected Behavior

Should be able to run without that error!

Link to reproduction

https://github.com/vercel/next.js

To Reproduce

git clone --depth=1 https://github.com/vercel/next.js.git

cd next.js

corepack enable pnpm

pnpm install

pnpm dev &

# wait

pnpm next examples/hello-world
@zxti zxti added the bug Issue was opened via the bug report template. label Sep 7, 2022
@github-actions github-actions bot added the please verify canary The issue should be verified against next@canary. It will be closed after 30 days of inactivity label Sep 7, 2022
@balazsorban44 balazsorban44 removed the please verify canary The issue should be verified against next@canary. It will be closed after 30 days of inactivity label Sep 7, 2022
@vercel vercel deleted a comment from github-actions bot Sep 7, 2022
@balazsorban44 balazsorban44 added Developer Experience Issues related to Next.js logs, Error overlay, etc. and removed bug Issue was opened via the bug report template. labels Sep 8, 2022
@balazsorban44
Copy link
Member

Currently, you'll need an initial pnpm build before running pnpm dev as the module/no-module packages are not built during pnpm dev.

@kodiakhq kodiakhq bot closed this as completed in #40335 Sep 30, 2022
kodiakhq bot pushed a commit that referenced this issue Sep 30, 2022
Utilize `turbo` for `dev`, and make sure polyfills are built. Fixes #40334

Another option would be to document that an initial `pnpm build` is necessary in  [`CONTRIBUTING.md`](https://github.com/vercel/next.js/blob/canary/contributing.md#developing).

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
BowlingX pushed a commit to BowlingX/next.js that referenced this issue Oct 5, 2022
Utilize `turbo` for `dev`, and make sure polyfills are built. Fixes vercel#40334

Another option would be to document that an initial `pnpm build` is necessary in  [`CONTRIBUTING.md`](https://github.com/vercel/next.js/blob/canary/contributing.md#developing).

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. 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 Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Developer Experience Issues related to Next.js logs, Error overlay, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants