openmrs-ocl-client "'PORT' is not recognized as an internal or external command"

"scripts": {
    "start": "PORT=8080 react-scripts start",
    "build": "react-scripts build",
    "lint": "eslint src --ext tsx",
    "test": "react-scripts test --testPathPattern='.*/tests/unit/|.*/__test__/'",
    "test:integration": "cypress run",
    "test:ci": "CI=true react-scripts test -u --testPathPattern='.*/tests/unit/|.*/__test__/' --ci --coverage",
    "test:bamboo": "node -v && CI=true react-scripts test --testPathPattern='.*/tests/unit/' --ci --coverage --env=jsdom --testResultsProcessor ./node_modules/jest-junit",
    "eject": "react-scripts eject",
    "prepare": "husky install"
  },

when i try to do npm start i come up with this error

C:\Users\LAPTOP AVENUE\Desktop\ocl\openmrs-ocl-client>npm start

ocl-client@0.1.0 start PORT=8080 react-scripts start

‘PORT’ is not recognized as an internal or external command, operable program or batch file.

C:\Users\LAPTOP AVENUE\Desktop\ocl\openmrs-ocl-client>npm start

> ocl-client@0.1.0 start
> PORT=8080 react-scripts start

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

could anyone assist me here… why its not working
cc @jwnasambu @herbert24 @reagan @dkayiwa @daudkakumirizi17 @sharif

Bash allows parameter assignments to prefix commands (e.g., FOO=BAR echo “$BAR”). Windows doesn’t support this. Try putting a semicolon after the port assignment and see if that helps – i.e., PORT=8080; react-scripts start.

@burke throws back the same error… does mean this has only to run on linux?

How about replacing? PORT=8080 react-scripts start

With: set PORT=8080 && react-scripts start

1 Like

Thanks @dkayiwa this magic set PORT=8080 && react-scripts start works fine :grinning:

The real fix would be to use something like cross-env for this. Or just stop using port 8080 and use the default React Scripts port (3000 IIRC).

2 Likes