'As I set HTTPS=true in package.json I get an error

I am trying to run my react application in secure mode but as soon as I set HTTPS as true in package.json I get the following error. The app works just fine in insecure mode. I have also tried using custom SSL certificates but that also gives the same error. I am running the application on windows 7.

"start": "set HTTPS=true&&react-scripts start"
set HTTPS=true&&react-scripts start
Starting the development server...
internal/buffer.js:944
class FastBuffer extends Uint8Array {}
RangeError: Invalid typed array length: -4095 at new Uint8Array (<anonymous>)
←[90m    at new FastBuffer (internal/buffer.js:944:1)←[39m
←[90m    at Handle.onStreamRead [as onread] (internal/stream_base_commons.js:185:19)←[39m
    at Stream.<anonymous> (C:\Users\bagrmeg\Downloads\ignited-dashboard\node_modules\←[4mhandle-thing←[24m\lib\handle.js:120:12)
←[90m    at Stream.emit (events.js:323:22)←[39m at endReadableNT (C:\Users\bagrmeg\Downloads\ignited-dashboard\node_modules\←[4mreadable-stream←[24m\lib\_stream_readable.js:1010:12)
←[90m    at processTicksAndRejections (internal/process/task_queues.js:84:21)←[39m
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `set HTTPS=true&&react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\bagrmeg\AppData\Roaming\npm-cache\_logs\2020-11-11T14_28_53_501Z-debug.log


Solution 1:[1]

After researching a bit about the issue, I found that it was an issue with React. You can find a detailed explanation of the issue in the following link - [https://github.com/facebook/create-react-app/issues/2759].

My App was using React: 16.2.0 and React script: 1.1.1. The issue stated above was fixed in the later versions of React. So, I created a new app with the latest React dependencies and it worked. The app was rendered on HTTPS.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1