Skip to content

Error in new Next.js 15 version #276

@TheCukitoDev

Description

@TheCukitoDev

I've got an error when I upgraded to Next 15. This is the next.config.ts file I used:

import type { NextConfig } from 'next'

await import('@/env')

const config: NextConfig = {}

And i just received this error:

C:\Users\Gabriel\Workspace\Proyectos\next-blog\next.config.compiled.js:53
await Promise.resolve().then(function() {
^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules
    at wrapSafe (node:internal/modules/cjs/loader:1281:20)
    at Module._compile (node:internal/modules/cjs/loader:1321:27)
    at requireFromString (C:\Users\Gabriel\Workspace\Proyectos\next-blog\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected][email protected]_5lakrbqt32k3gsjhjvvzwqmo3u\node_modules\next\dist\build\next-config-ts\require-hook.js:81:7)
    at transpileConfig (C:\Users\Gabriel\Workspace\Proyectos\next-blog\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected][email protected]_5lakrbqt32k3gsjhjvvzwqmo3u\node_modules\next\dist\build\next-config-ts\transpile-config.js:63:51)
    at async loadConfig (C:\Users\Gabriel\Workspace\Proyectos\next-blog\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected][email protected]_5lakrbqt32k3gsjhjvvzwqmo3u\node_modules\next\dist\server\config.js:763:36)
    at async Module.nextDev (C:\Users\Gabriel\Workspace\Proyectos\next-blog\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected][email protected]_5lakrbqt32k3gsjhjvvzwqmo3u\node_modules\next\dist\cli\next-dev.js:189:14)

Node.js v20.15.1
 ELIFECYCLE  Command failed with exit code 1.

I don't know what to do...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions