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

[Turbopack] Error: ENOENT: no such file or directory, open '[project]/......' #75264

Open
HMubaireek opened this issue Jan 24, 2025 · 0 comments
Labels
Turbopack Related to Turbopack with Next.js.

Comments

@HMubaireek
Copy link

HMubaireek commented Jan 24, 2025

Link to the code that reproduces this issue

https://github.com/HMubaireek/nextjs-turbopack-zeebe-node

To Reproduce

  1. Clone the repo, run npm install, then serve the app with: npx nx dev nextjs-with-zeebe-node --turbo
  2. Open this link in the browser: http://localhost:3000/api/zeebe
  3. See the error in terminal.

Current vs. Expected behavior

This is the error that appears:

Error: ENOENT: no such file or directory, open '[project]/node_modules/zeebe-node/dist/proto/zeebe.proto'
    at GET (apps/nextjs-with-zeebe-node/src/app/api/zeebe/route.ts:10:22)
   8 |
   9 |   try{
> 10 |   const zeebeClient = new ZBClient('localhost:26500');
     |                      ^
  11 |   isConnected = zeebeClient.connected;
  12 |   } catch (error) {
  13 |     console.error(error); {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '[project]/node_modules/zeebe-node/dist/proto/zeebe.proto'
}

The library used can't find a file, which is fine, but the problem is in the [project] in the path. When running with webpack instead, the error is:

Error: ENOENT: no such file or directory, open '/home/hasm/repositories/sandbox/org/apps/nextjs-with-zeebe-node/.next/proto/zeebe.proto'

So, I know which path it is looking for, and that is fixed easily with this addition to next.config.js file:

  webpack: (config, { isServer }) => {
    config.plugins = [
      ...(config.plugins || []),
      new CopyPlugin({
        patterns: [
          {
            from: '../../node_modules/zeebe-node/proto',
            to: 'proto',
          },
        ],
      })
    ];

    return config;
  }

With this, serving the app without --turbo flag works as expected.

I tried to put the file manually in many places but that didn't work.

So, the question is, what is this [project] in the path, and how to fix it with turbopack?

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #202409151536 SMP PREEMPT_DYNAMIC Sun Sep 15 16:01:12 UTC 2024
  Available memory (MB): 47875
  Available CPU cores: 12
Binaries:
  Node: 22.6.0
  npm: 10.8.2
  Yarn: 0.32+git
  pnpm: 9.15.2
Relevant Packages:
  next: 15.1.6 // Latest available version is detected (15.1.6).
  eslint-config-next: 15.1.6
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.6.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

  1. The library tries to load the file like this:
protoPath: path.join(__dirname, '../../proto/zeebe.proto'),
  1. I used nx to create the sample repo but the issue is the same without it, and here a sample repo created with nextjs only: https://github.com/HMubaireek/nextjs-turbopack-zeebe-node-standalone it's exactly the same error.
@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

1 participant