tsci dev: ngspice spiceEngine from tscircuit.config.ts fails three ways (package.json, top-level await, blob import)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 22/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- bun, react, typescript
Hướng nghiên cứu
Start in loadTscircuitConfig, where tscircuit.config.ts is evaluated, and compare how importEvalPath resolves @tscircuit/ngspice-spice-engine against the tsci build path. The browser failure needs the analog simulation loader and the blob import resolution, which the payload does not show. Done means tsci dev loads the ngspice config, runs the analog simulation without the blob import error, and the top-level await case works or gives a clear message.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
A project that registers ngspice in tscircuit.config.ts works with tsci build and tsci simulate, but not in tsci dev. There are three separate failures in a row. The first two have workarounds; the third doesn't.
Versions: tscircuit 0.0.3062 (CLI), @tscircuit/core 0.0.2259, @tscircuit/ngspice-spice-engine 0.0.22, @tscircuit/eval 0.0.1696, macOS arm64, Bun 1.3.14.
Repro
tsci init ngspice-dev-repro -y && cd ngspice-dev-repro
index.circuit.tsx:
export default () => (
<board width="20mm" height="15mm" routingDisabled>
<voltagesource name="V1" voltage="5V" />
<resistor name="R1" resistance="1k" connections={{ pin1: ".V1 > .pin1" }} />
<capacitor name="C1" capacitance="10uF" connections={{ pin1: ".R1 > .pin2", pin2: ".V1 > .pin2" }} />
<voltageprobe name="VCAP" connectsTo=".C1 > .pin1" />
<analogsimulation duration="50ms" timePerStep="0.5ms" spiceEngine="ngspice" />
</board>
)
Failure 1: package not in package.json
tscircuit.config.ts:
import createNgspiceSpiceEngine from "@tscircuit/ngspice-spice-engine"
export default {
platformConfig: { spiceEngineMap: { ngspice: await createNgspiceSpiceEngine() } },
}
tsci build index.circuit.tsx works (the package is installed as a transitive dependency of tscircuit). tsci dev → Errors:
Execution Error: Node module imported but not in package.json "@tscircuit/ngspice-spice-engine"
importEvalPath("./tscircuit.config.ts", ...) importLocalFile("tscircuit.config.ts")
importEvalPath("@tscircuit/ngspice-spice-engine", ...) importNodeModule("@tscircuit/ngspice-spice-engine")
at loadTscircuitConfig
Workaround: bun add -d @tscircuit/ngspice-spice-engine.
Failure 2: top-level await in tscircuit.config.ts
With the same config, tsci dev then shows:
Execution Error: Error evaluating "tscircuit.config.ts": Unexpected identifier '_ngspicespiceengine2'
at loadTscircuitConfig
The in-browser evaluator can't handle the top-level await, though the CLI can. Workaround: create the engine lazily.
let engine: ReturnType<typeof createNgspiceSpiceEngine> | undefined
export default {
platformConfig: {
spiceEngineMap: {
ngspice: {
simulate: async (spice: string) => {
engine ??= createNgspiceSpiceEngine()
return (await engine).simulate(spice)
},
},
},
},
}
Failure 3: the engine can't load in the dev browser (no workaround)
The config now loads, and the PCB view renders. ⋯ → Analog Simulation shows:
Error running analog simulation
Import "blob:http://localhost:3020/352059b6-0861-489a-8d1d-2f9bf2683551" not found in "node_modules/@tscircuit/ngspice-spice-engine/dist"
The same circuit with the default spicey engine (no spiceEngine prop) renders its graph in the Analog Simulation view.
Expected
Either ngspice works in tsci dev, or the docs say that spiceEngine="ngspice" is CLI-only. It would also help if failures 1 and 2 gave a hint, since the same config works in tsci build.
🤖 Generated with Claude Code
- Ngôn ngữ chính
- TypeScript
- Star
- 19
- Fork
- 115
- Merge trung bình
- 1 giờ 50 phút
- Pull request đã merge (30 ngày)
- 260
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tscircuit/cli
-
`tsci check` and `tsci check netlist` exit 0 when they report errorsCó thể đã có người làm @aswadi đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 57/100
Maintainer thường phản hồi trong vòng 1 ngày
-
@tscircuit/cli 0.1.2452 bundles brace-expansion 2.0.1 and minimatch 5.1.2 (via make-vfs), both with published advisoriesCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
tsci export -f glb can't load a relative cadModel stepUrl (404); build --glbs canCó thể đã có người làm @jeffrey-graham đã nhận 8 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
The CLI needs Bun: under Node alone `tsci` fails and the Node entry can't load `.tsx`Có thể đã có người làm @cocvn157 đã nhận 7 ngày trước. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 35/100
tscircuit/cli#5449 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`tsci check netlist` prints `undefined` after a resistor's value and labels resistor pins anode / cathodeCó thể đã có người làm @cocvn157 đã nhận 10 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
tscircuit/cli#5447 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của tscircuit/cli
Issue tương tự
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
openclaw/openclaw#199885 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
feature needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
BoardGamesEmpire/board-games-empire-backend#1306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
sequant-io/sequant#1689 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100