Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #8521
Closed
Open
Issue created Feb 20, 2020 by Administrator@rootContributor

Don't swallow git error message

Created by: pastelmind

Is your proposal related to a problem?

When git commit fails for some reason (e.g. user.name is not set -- see #6442 (closed)), CRA swallows git's output and displays a rather cryptic error message:

Git commit not created Error: Command failed: git commit -m "Initialize project using Create React App"
    at checkExecSyncError (child_process.js:621:11)
    at execSync (child_process.js:657:15)
    at tryGitCommit (/home/pastelmind/test-app/node_modules/react-scripts/scripts/init.js:62:5)
    at module.exports (/home/pastelmind/test-app/node_modules/react-scripts/scripts/init.js:335:25)
    at [eval]:3:14
    at Script.runInThisContext (vm.js:116:20)
    at Object.runInThisContext (vm.js:306:38)
    at Object.<anonymous> ([eval]-wrapper:9:26)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at evalScript (internal/process/execution.js:80:25) {
  status: 128,
  signal: null,
  output: [ null, null, null ],
  pid: 2531,
  stdout: null,
  stderr: null
}
Removing .git directory...

Currently, init.js calls child_process.spawnSync() with stdio: 'ignore', which completely swallows Git's error message and leaves the user in the dark.

Describe the solution you'd like

Use stdio: 'pipe', at least for stderr. Also use encoding: 'utf-8' (or whatever is appropriate), because otherwise the stdout is a Buffer object--which isn't really helpful when printed on the terminal.

Describe alternatives you've considered

(Write your answer here.)

Additional context

(Write your answer here.)

Assignee
Assign to
Time tracking