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
  • Merge requests
  • !8694

Use process.execPath to spawn node subprocess

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/anuraaga/explicit-node-path into master Mar 23, 2020
  • Overview 8
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: anuraaga

Instead of requiring Node to be on the system PATH.

Currently, react-scripts spawns scripts such as test, build by specifying an executable name, node. This requires node to be on the system PATH. Some users (like me) may not have it on the system PATH and normally don't have problems since an IDE like Webstorm configured with a node interpreter mostly runs tests and builds without any problem. However, this doesn't work with create-react-app because it expects node on the PATH.

Luckily, there is an easy way of getting an absolute path to the current interpreter binary so we can use it and remove the requirement that node is on the system PATH.

I have verified that before this change, running tests in Webstorm failed with this

'node' is not recognized as an internal or external command,
operable program or batch file.

while after the change, tests run.

I ran yarn run format which pulled in an unrelated file. Hope it's ok to update it so people don't keep on running into it when sending a change.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/anuraaga/explicit-node-path