Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix npm run build failing with missing api/client module errors - #2

Merged
rattalur merged 1 commit into
mainfrom
copilot/fix-npm-run-build-error
Sep 3, 2026
Merged

rattalur merged 1 commit into
mainfrom
copilot/fix-npm-run-build-error

Conversation

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown

npm run build (and npm test, npm run check-types, npm start) fails on a fresh clone with Cannot find module '../api/client/**'. The generated API client (src/api/client/) is gitignored and only materializes after manually running npm run update-api, which nothing enforces before these scripts run.

Fix

  • Added an ensure-api-client script (test -d ./src/api/client || npm run update-api) that generates the client only when missing
  • Wired it as a pre* hook on build, test, check-types, and start so those scripts self-heal on a fresh clone
  • No-op when src/api/client/ already exists, so CI (which already runs update-api explicitly) makes no extra network call

Docs

  • Updated SPECS/setup.md and AGENTS.md quick reference to document the auto-bootstrap behavior
  • Added changelog entry in SPECS/README.md and a changeset
"scripts": {
  "ensure-api-client": "test -d ./src/api/client || npm run update-api",
  "prebuild": "npm run ensure-api-client",
  "pretest": "npm run ensure-api-client",
  "precheck-types": "npm run ensure-api-client",
  "prestart": "npm run ensure-api-client"
}

@rattalur
rattalur marked this pull request as ready for review September 3, 2026 07:21
@rattalur
rattalur merged commit a24523f into main Sep 3, 2026
@rattalur
rattalur deleted the copilot/fix-npm-run-build-error branch September 3, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants