Skip to content

Conversation

@sgasho
Copy link

@sgasho sgasho commented May 25, 2025

What does this PR do?

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

this PR prints syntax errors in package.json.

close: #19604

How did you verify your code works?

I added some test cases at run_command.test.ts.

  • I included a test for the new code, or an existing test covers it
  • I wrote TypeScript/JavaScript tests and they pass locally (bun-debug test test-file-name.test)

Also, when I tested the "bun run" with an invalid package.json, it no longer printed "No package.json found." Instead, it printed syntax errors and the message "Failed parsing package.json."

Here are some screen shots.

package.json

{
    "name": "bun-bug",
    "scripts": {
      "start": "pwd",
      "install": "echo DDDD"
    },
    "module": "index.ts",
    "type": "module",
    "private": True,
    "devDependencies": {
      "@types/bun": "latest",
      "prettier":"latest"
    },
    "peerDependencies": {
      "typescript": "^5"
    }
}
before(The "No package.json found" message was printed out even though the package.json(has a syntax error though) file does exist.) after(syntax error in package.json was printed out)
スクリーンショット 2025-05-25 17 51 43 スクリーンショット 2025-05-25 17 48 22

@sgasho sgasho closed this by deleting the head repository Sep 7, 2025
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.

bun run returns "No package.json found." when package.json has syntax errors.

1 participant