【问题标题】:As I set HTTPS=true in package.json I get an error当我在 package.json 中设置 HTTPS=true 时,出现错误
【发布时间】:2020-11-11 15:12:15
【问题描述】:

我正在尝试以安全模式运行我的 react 应用程序,但是一旦我在 package.json 中将 HTTPS 设置为 true,我就会收到以下错误。该应用程序在不安全模式下运行良好。我也尝试过使用自定义 SSL 证书,但这也给出了同样的错误。我在 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! igniter@0.1.0 start: `set HTTPS=true&&react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the igniter@0.1.0 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

【问题讨论】:

    标签: reactjs ssl https


    【解决方案1】:

    在对该问题进行了一些研究后,我发现这是 React 的问题。您可以在以下链接中找到该问题的详细说明 - [https://github.com/facebook/create-react-app/issues/2759]

    我的应用使用 React:16.2.0 和 React 脚本:1.1.1。上述问题已在 React 的更高版本中修复。因此,我使用最新的 React 依赖项创建了一个新应用程序,并且它工作正常。该应用程序是在 HTTPS 上呈现的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-04
      • 2017-06-22
      相关资源
      最近更新 更多