Skip to content

Error with compiled modules using symlinksΒ #40206

Closed as not planned
Closed as not planned
@nachoaldamav

Description

Verify canary release

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

Provide environment information

    Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Wed Jul 27 02:20:31 UTC 2022
    Binaries:
      Node: 18.4.0
      npm: 8.12.1
      Yarn: 1.22.19
      pnpm: 7.9.5
    Relevant packages:
      next: 12.2.3
      eslint-config-next: 12.2.5
      react: 17.0.2
      react-dom: 17.0.2

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

When installing Next through a symlink Next is unable to reach compiled modules.
Example:

Custom next path: /home/user/node_cache/next/12.2.6-canary.8
Symlinked to /home/user/next-demo/node_modules/next

The custom next path has it's own node_modules with everything installed.

When running next dev it fails with error Cannot find module 'next/dist/compiled/chalk', if that module is modified to point to the correct route (ex: ../compiled/chalk) same error appears but with another module.

Expected Behavior

Be able to run next through symlinked installation path.

Link to reproduction

https://github.com/nachoaldamav/snpm/tree/main/examples/next

To Reproduce

npm install -g @snpm-io/cli
snpm install
npm run dev

This steps installs a Package Manager called SNPM (It's made by me for testing and playing purposes)

To clear everything related to the custom CLI execute the following commands

snpm clear
npm uninstall @snpm-io/cli -g

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.lockedstaleThe issue has not seen recent activity.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions