PNPM_HOME path containing node_modules causes tsc to fail emitting assets (TS Bug #28432)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 217
- Avg merge
- 8h 42m
- Merged PRs (30d)
- 1
Description
When using pnpm/action-setup, the action sets PNPM_HOME to a path that includes a node_modules directory (e.g., /home/runner/setup-pnpm/node_modules/.bin).
If a project runs tsc (TypeScript Compiler) while nested within this directory structure - which happens during certain pnpm lifecycle scripts or when pnpm is invoked from this path - tsc fails to emit non-code assets like *.json files.
This is caused by a long-standing, unresolved bug in TypeScript: Issue #28432: tsc fails to emit required files when run below node_modules.
TypeScript has a hard-coded heuristic that prevents it from emitting files if it detects node_modules anywhere in the absolute path. Because pnpm/action-setup installs pnpm into a path containing node_modules, it triggers this bug, leading to "works locally, fails in CI" scenarios where dist folders are missing critical JSON assets.
Steps to Reproduce
- Use pnpm/action-setup in a GitHub Action.
- Have a dependency TypeScript project that imports a JSON file:
import data from './data.json' with { type: 'json' };. - This dependency should be built during install stage, for example by installing it as dependency with
github:...source url. - Try to run
pnpm installin dependent project.
Result: The command fails because .js files are created in dist/ of dependency, but .json files are missing.
Suggestion: change PNPM_HOME to something not containing node_modules
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the pnpm/action-setup entry point that assigns PNPM_HOME and inspect how its path is constructed; then reproduce the issue with pnpm install and the dependency build described here. Done means the action no longer places PNPM_HOME below a node_modules path and the reproduction emits the dependency's JSON assets into dist/.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100