Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

rollup error - "Cannot read properties of undefined (reading '0')" on `npm run build`

Open
#174 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
node.js, rollup, typescript, vite
Domain
build-system

Research direction

Reproduce the failure with npm init marko -- -t basic, then run npm run build and trace the stack through @marko/run, Vite, and Rollup at node_modules/rollup/dist/es/shared/node-entry.js. Done means the generated basic Marko project builds successfully on the reported environments without the sourcemap error.

Written by the indexing model from the issue text.

Description

node_modules/rollup/dist/es/shared/node-entry.js:20199
                return source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : name);
                                                                                                    ^
Cannot read properties of undefined (reading '0')

Reproduce steps:

  • npm init marko -- -t basic
  • cd my-app
  • npm run build

Versions:

~/Developer/Scratch % npm init marko -- -t basic

> npx
> create-marko -t basic

✔ Type your project name · my-app
✔ Project created! To get started, run:

    cd my-app
    npm run dev

 ~/Developer/Scratch % cd my-app 
 ~/Developer/Scratch/my-app % npm ls vite rollup @marko/run          git:(main)
[email protected] /Users/iankulin/Developer/Scratch/my-app
└─┬ @marko/[email protected]
  ├─┬ @marko/[email protected]
  │ └── @marko/[email protected] deduped
  ├─┬ @marko/[email protected]
  │ └── [email protected] deduped
  └─┬ [email protected]
    └── [email protected]

 ~/Developer/Scratch/my-app % node -v                                git:(main)
v22.14.0
 ~/Developer/Scratch/my-app % npm run build                          git:(main)

> [email protected] build
> marko-run build

✗ Build failed in 45ms
file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20199
                return source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : name);
                                                                                                    ^

Cannot read properties of undefined (reading '0')
    at Link.traceSegment (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20199:101)
    at Link.traceSegment (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20199:31)
    at Link.traceMappings (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20141:39)
    at collapseSourcemaps (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20245:63)
    at transformChunk (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20349:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20395:17
    at async Promise.all (index 0)
    at async transformChunksAndGenerateContentHashes (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20390:5)
    at async renderChunks (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20299:151)
    at async Bundle.generate (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20558:13)
    at async file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:23424:27
    at async catchUnfinishedHookActions (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/rollup/dist/es/shared/node-entry.js:22791:16)
    at async buildEnvironment (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/vite/dist/node/chunks/config.js:34162:64)
    at async Object.build (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/vite/dist/node/chunks/config.js:34519:19)
    at async build (file:///Users/iankulin/Developer/Scratch/my-app/node_modules/@marko/run/dist/cli/index.mjs:2726:3)
    at async file:///Users/iankulin/Developer/Scratch/my-app/node_modules/@marko/run/dist/cli/index.mjs:2802:3

Node.js v22.14.0

and on a Debian VM:

ian@vm601-marko:~$ npm init marko -- -t basic
Need to install the following packages:
[email protected]
Ok to proceed? (y) 


> npx
> "create-marko" -t basic

✔ Type your project name · my-app
✔ Project created! To get started, run:

    cd my-app
    npm run dev

ian@vm601-marko:~$ cd my-app
ian@vm601-marko:~/my-app$ npm ls vite rollup @marko/run 
[email protected] /home/ian/my-app
└─┬ @marko/[email protected]
  ├─┬ @marko/[email protected]
  │ └── @marko/[email protected] deduped
  ├─┬ @marko/[email protected]
  │ └── [email protected] deduped
  └─┬ [email protected]
    └── [email protected]

ian@vm601-marko:~/my-app$ node -v
v22.21.0
ian@vm601-marko:~/my-app$ npm run build

> [email protected] build
> marko-run build

✗ Build failed in 268ms
file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20199
                return source.traceSegment(segment[2], segment[3], segment.length === 5 ? this.names[segment[4]] : name);
                                                                                                    ^

Cannot read properties of undefined (reading '0')
    at Link.traceSegment (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20199:101)
    at Link.traceSegment (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20199:31)
    at Link.traceMappings (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20141:39)
    at collapseSourcemaps (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20245:63)
    at transformChunk (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20349:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20395:17
    at async Promise.all (index 0)
    at async transformChunksAndGenerateContentHashes (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20390:5)
    at async renderChunks (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20299:151)
    at async Bundle.generate (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:20558:13)
    at async file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:23424:27
    at async catchUnfinishedHookActions (file:///home/ian/my-app/node_modules/rollup/dist/es/shared/node-entry.js:22791:16)
    at async buildEnvironment (file:///home/ian/my-app/node_modules/vite/dist/node/chunks/config.js:34162:64)
    at async Object.build (file:///home/ian/my-app/node_modules/vite/dist/node/chunks/config.js:34519:19)
    at async build (file:///home/ian/my-app/node_modules/@marko/run/dist/cli/index.mjs:2726:3)
    at async file:///home/ian/my-app/node_modules/@marko/run/dist/cli/index.mjs:2802:3

Node.js v22.21.0
ian@vm601-marko:~/my-app$ 
Dominant language
TypeScript
Stars
175
Forks
16
Avg merge
3d 12h
Merged PRs (30d)
6

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from marko-js/run

All issues in marko-js/run

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.