node.js - Gulp 在第一个 XHR 请求时崩溃并出现 HPE_INVALID_CONSTANT 错误

标签 node.js angularjs npm gulp

我正在开发一个 AngularJS 1.7.x 应用程序(3 年前开始),当我开始使用 Gulp 时,我使用了这个工具。

昨天,当我继续我的应用程序工作时,我突然在第一个 XHR 请求上崩溃了。

所以我运行“gulpserve”,它打开带有登录页面的 chrome,所有内容都正确加载,然后,我单击登录按钮,这会向我的 PHP 后端(由 Apache/2.4.37 提供服务)发出 REST 调用(Unix) PHP/7.2.14)

我的项目的package.json已经很长一段时间没有改变了。 我最近更新了 npm (6.9.0) 和 node (8.11.1),但并不是最近的。

 [12:14:13] Starting 'serve'...
[HPM] Proxy created: /rest  ->  http://localhost/
[12:14:13] Finished 'serve' after 49 ms
[BrowserSync SPA] Running...
[Browsersync] Access URLs:
 --------------------------------------
       Local: http://localhost:3000/
    External: http://192.168.1.21:3000/
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://localhost:3001
 --------------------------------------
[Browsersync] Serving files from: .tmp/serve
[Browsersync] Serving files from: src
[HPM] Error occurred while trying to proxy request /rest/authenticate from localhost:3000 to http://localhost/ (HPE_INVALID_CONSTANT) (https://nodejs.org/api/errors.html#errors_common_system_errors)
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at write_ (_http_outgoing.js:622:15)
    at ServerResponse.write (_http_outgoing.js:617:10)
    at IncomingMessage.ondata (_stream_readable.js:639:20)
    at emitOne (events.js:116:13)
    at IncomingMessage.emit (events.js:211:7)
    at IncomingMessage.Readable.read (_stream_readable.js:475:10)
    at flow (_stream_readable.js:846:34)
    at resume_ (_stream_readable.js:828:3)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

最佳答案

在我的 php 后端中,我的配置文件给出了一个空的“ReCaptcha” secret ,最终导致 gulp/proxy 崩溃... 无法理解为什么 ReCaptcha 抛出的错误会让代理如此困惑......

关于node.js - Gulp 在第一个 XHR 请求时崩溃并出现 HPE_INVALID_CONSTANT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55163512/

相关文章:

macos - 错误 : The 'brew link' step did not complete successfully

javascript - Angular $resource 中的自定义实例方法

javascript - 获取所有 Angular Controller

javascript - 如何从 npm 注册表中删除 npm 包?

node.js - NPM install 在安装 express 时出现错误

javascript - 追加到 API Node.js 中的数组

node.js - 使用 passport-jwt 授权 jwt token 时获得 401 未授权状态

node.js - Storybook 似乎无法在 Node 10.15.3 上运行

javascript - ng-repeat 在一个应用程序中有效,但在另一个应用程序中无效

javascript - 在 node.js 中获取控制台路径