expo / expo/examples

create-expo-app with with-tv example fails on Windows (ENOENT + ERR_INVALID_ARG_TYPE)

Open
#708 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.7k
Forks
1.1k
Avg merge
11h 15m
Merged PRs (30d)
1

Description

**Describe the bug**
Creating project from `with-tv` example fails on Windows. The tool attempts to read `package.json` before the example files are fully extracted, resulting in `ENOENT` file‑not‑found error, then crashes with `ERR_INVALID_ARG_TYPE` because it passes string `ENOENT` to `process.exitCode` which expects a number.

```
npx create-expo-app -e with-tv
√ What is your app named? ... tv_live
Creating tv_live using the with-tv example.

× Something went wrong in downloading and extracting the example files: Can't read JSON file: F:\workspace\tv_live\package.json
└─ Cause: Error: ENOENT: no such file or directory, open 'F:\workspace\tv_live\package.json'
JsonFileError: Can't read JSON file: F:\workspace\tv_live\package.json
└─ Cause: Error: ENOENT: no such file or directory, open 'F:\workspace\tv_live\package.json'
node:internal/bootstrap/node:119
validateInteger(value, 'code');
^

TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ENOENT')
at process.set [as exitCode] (node:internal/bootstrap/node:119:9)
at process.exit (node:internal/process/per_thread:231:24)
at C:\Users\sujia\AppData\Local\npm-cache\_npx\a712338f43e79bae\node_modules\create-expo-app\build\index.js:49:753
at
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async run (C:\Users\sujia\AppData\Local\npm-cache\_npx\a712338f43e79bae\node_modules\create-expo-app\build\index.js:49:721) {
code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v24.18.0
```

**To Reproduce**
Steps to reproduce the behavior:
1. Open terminal on Windows 11
2. Run command:
```bash
npx create-expo-app -e with-tv
```
3. Input project name, for example `tv_live`
4. Observe crash during downloading and extracting example files phase

**Expected behavior**
- Successfully download and extract the `with-tv` example template
- Generate complete project with valid `package.json`
- Gracefully handle extraction failures, set numeric exit code instead of passing string error code to `process.exitCode`

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: Windows 11
- Node.js: v24.18.0
- npm/npx: npx (built‑in)

**Additional context**
Failure occurs before project template files are written to disk; target folder `tv_live` may be partially created or empty. Secondary bug: error handling passes string `ENOENT` to `process.exitCode` which expects number, causing secondary crash masking the original extraction issue.

Contributor guide

Open the contributing guide

Research direction

Reproduce `npx create-expo-app -e with-tv` on Windows 11 and inspect the extraction failure around the generated `build/index.js` entry point and the missing `package.json`. Verify that the `with-tv` example produces a complete project and that extraction failures exit with a numeric code without the secondary `ERR_INVALID_ARG_TYPE` crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, react-native, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.