marko-js / marko-js/run

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

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
175
Forks
17
Avg merge
5h 26m
Merged PRs (30d)
5

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:

  • M3 MacBook, macOS 15.6.1
  • node v22.14.0
  • vite@7.2.2
  • rollup@4.53.1
~/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)
my-app@1.0.0 /Users/iankulin/Developer/Scratch/my-app
└─┬ @marko/run@0.9.3
  ├─┬ @marko/run-explorer@2.0.2
  │ └── @marko/run@0.9.3 deduped
  ├─┬ @marko/vite@5.3.4
  │ └── vite@7.2.2 deduped
  └─┬ vite@7.2.2
    └── rollup@4.53.1

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

> my-app@1.0.0 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:
create-marko@6.1.1
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 
my-app@1.0.0 /home/ian/my-app
└─┬ @marko/run@0.9.3
  ├─┬ @marko/run-explorer@2.0.2
  │ └── @marko/run@0.9.3 deduped
  ├─┬ @marko/vite@5.3.4
  │ └── vite@7.2.2 deduped
  └─┬ vite@7.2.2
    └── rollup@4.53.1

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

> my-app@1.0.0 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$ 

Contributor guide

No contributing guide indexed for this repository

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.