0

I'm adding

HTTPS=true

to my package.json and starting my react frontend as always with "npm start" but it gives me

The command "HTTPS" is either misspelled or could not be found.
npm ERR! code ELIFECYCLE
npm ERR! errno 1

My package.json:

"scripts": {
    "start": "SET HTTPS=true & SSL_CRT_FILE=domain.com.pem & SSL_KEY_FILE=domain.com-key.pem & cross-env HOST=domain.com react-scripts start",

I tried everything I found all over the place online but I destroyed more than I fixed an nothing seemed to work at the end. I'm on windows and tried different shells different formats with and without spaces, add "set " and "SET " at front and so on. Does anyone know why it seem to cannot find the HTTPS command?

BenjaminK
  • 653
  • 1
  • 9
  • 26
  • Does this answer your question? ["NODE\_ENV" is not recognized as an internal or external command, operable command or batch file](https://stackoverflow.com/questions/11928013/node-env-is-not-recognized-as-an-internal-or-external-command-operable-comman) – jonrsharpe Apr 16 '21 at 10:46
  • I've tried "set" and "SET" already but its not starting anything after adding this. So it's sadly not fixing the error at all. – BenjaminK Apr 16 '21 at 10:49
  • So *show that*, but trying the *nix way certainly isn't going to work. – jonrsharpe Apr 16 '21 at 10:51
  • @jonrsharpe thank you, so I added the full package.json line above so you can take a look at it. – BenjaminK Apr 16 '21 at 11:03
  • Do you get the same error? Why haven't you used set with the other env vars? – jonrsharpe Apr 16 '21 at 11:33

1 Answers1

0

I got around this by using cross-env which allowed me to set my package.json to work on cross-platform as well. As this error came from trying to set HTTPS like on Linux based systems.

cross-env documentation: https://www.npmjs.com/package/cross-env

"start": "cross-env HTTPS=true SSL_CRT_FILE=domain.com.pem SSL_KEY_FILE=domain.com-key.pem HOST=domain.com react-scripts start"
BenjaminK
  • 653
  • 1
  • 9
  • 26