Skip to content

NPM cannot resolve Astro Actions virtual module #14572

@haetae-bit

Description

@haetae-bit

Astro Info

I'm working on a WSL2 setup, but here's the info I got from `astro info`:

Astro                    v5.14.6
Vite                     v6.4.0
Node                     v22.20.0
System                   Linux (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node (v9.5.0)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I've been developing my project with Astro using pnpm, but when I try running my project with npm, I get this error when I start my development server using npm run dev:

✘ [ERROR] Could not resolve "virtual:astro:actions/options"

    node_modules/astro/dist/virtual-modules/actions.js:1:42:
      1 │ import { shouldAppendTrailingSlash } from "virtual:astro:actions/options";~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "virtual:astro:actions/options" as external to exclude it from the bundle,
  which will remove this error and leave the unresolved path in the bundle.

✘ [ERROR] Could not resolve "virtual:astro:actions/runtime"

    node_modules/astro/dist/virtual-modules/actions.js:10:14:
      10 │ export * from "virtual:astro:actions/runtime";~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "virtual:astro:actions/runtime" as external to exclude it from the bundle,
  which will remove this error and leave the unresolved path in the bundle.

18:52:47 [ERROR] [UnhandledRejection] Astro detected an unhandled rejection. Here's the stack trace:
Error: Build failed with 2 errors:
node_modules/astro/dist/virtual-modules/actions.js:1:42: ERROR: Could not resolve "virtual:astro:actions/options"
node_modules/astro/dist/virtual-modules/actions.js:10:14: ERROR: Could not resolve "virtual:astro:actions/runtime"

I can't find any way where this unhandled rejection might be coming from and prevents a dev server from running at all.

What's the expected result?

I would expect a more precise message of where this unhandled error would be instead of throwing an error immediately on a virtual import.

I'll link to the project this issue is happening at the moment since producing a minimal reproduction didn't seem to throw the same error.

Link to Minimal Reproducible Example

https://github.com/haetae-bit/fanfic-atproto

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Labels

- P5: urgentFix build-breaking bugs affecting most users, should be released ASAP (priority)feat: actionsRelated to Astro actions (scope)regression

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions