"Error parsing package.json file" when using `file:` dependency (symlinked files)
Open
Nobody has claimed this yet.
Turbopack
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/rubenferreira97/turbopack_issue
To Reproduce
- Start application in dev mode
- Go to initial page (http://localhost:3000)
- Check error:
⨯ ./next/node_modules/lib/package.json
Error parsing package.json file
package.json is not parseable: invalid JSON: a redirect can't be parsed as json
Current vs. Expected behavior
- Expected: Turbopack resolves symlinked files correctly and imports
libNumberfromlib. - Actual: Turbopack reports
Error parsing package.json file.
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Education
Available memory (MB): 16237
Available CPU cores: 12
Binaries:
Node: 24.11.0
npm: 11.6.1
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 16.1.0 // Latest available version is detected (16.1.0).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
## Error Type
Build Error
## Error Message
Error parsing package.json file
## Build Output
./next/node_modules/lib/package.json
Error parsing package.json file
package.json is not parseable: invalid JSON: a redirect can't be parsed as json
Next.js version: 16.1.0 (Turbopack)
Contributor guide
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 with the linked reproduction repository and reproduce the error on Windows using the reported file: dependency and symlink setup. Then trace Turbopack's package.json handling for the affected path; done means the symlinked dependency resolves and imports libNumber without a parse error in dev, build, and start.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs, react
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100