Skip to content

anchor test es module error when ubuntu-latest upgraded to nodejs 23+ #404

@poroburu

Description

@poroburu

investigation:

repo:solana-developers/program-examples path:**/anchor/tests/**test.ts require import

I am investigating a commonjs es module parsing error:

(node:654301) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/poroburu/git/solana/program-examples/basics/checking-accounts/anchor/tests/bankrun.test.ts is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /home/poroburu/git/solana/program-examples/basics/checking-accounts/anchor/package.json.

Both github action anchor test runs occur on the same commit: 69d6179

https://github.com/solana-developers/program-examples/actions/runs/16843522316
https://github.com/solana-developers/program-examples/actions/runs/16819369110

https://github.com/solana-developers/program-examples/blob/69d61792613b5e2de9723954118336eaef3ec7a1/.github/workflows/anchor.yml

With the assistance of grok, we have identified that ubuntu-latest rolled out an upgrade to node 23 between these runs.

reproduction:

cd basics/checking-accounts/anchor
pnpm i
anchor test

nvm use 22 passes ✅
nvm use 23 fails ❌

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