Как выяснить, почему происходит ошибка при запуске приложения в ember fastboot - PullRequest
2 голосов
/ 26 апреля 2020

Я пытаюсь интегрировать стороннюю библиотеку npm (редактор js вроде npm package npm i @editorjs/editorjs --save-dev) в приложение ember с автоматической загрузкой "ember-auto-import": "^1.5.3",

Все работает без fastboot , но при сбое приложения fastboot со следующей ошибкой:

nodejs_1      |  TypeError: Cannot read property 'syscall' of null
nodejs_1      |     at AppendOpcodes.evaluate (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@glimmer/runtime.js:2003:1)
nodejs_1      |     at LowLevelVM.evaluateSyscall (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@glimmer/runtime.js:4923:1)
nodejs_1      |     at LowLevelVM.evaluateInner (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@glimmer/runtime.js:4879:1)
nodejs_1      |     at LowLevelVM.evaluateOuter (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@glimmer/runtime.js:4871:1)
nodejs_1      |     at JitVM.next (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@glimmer/runtime.js:5815:1)
nodejs_1      |     at TemplateIteratorImpl.next (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@glimmer/runtime.js:5944:1)
nodejs_1      |     at RootState.render (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@ember/-internals/glimmer/index.js:8771:1)
nodejs_1      |     at runInAutotrackingTransaction (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@glimmer/validator.js:106:1)
nodejs_1      |     at /tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@ember/-internals/glimmer/index.js:9069:1
nodejs_1      |     at inTransaction (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@glimmer/runtime.js:1959:1)
nodejs_1      |     at InertRenderer._renderRoots (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@ember/-internals/glimmer/index.js:9043:1)
nodejs_1      |     at InertRenderer._renderRootsTransaction (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@ember/-internals/glimmer/index.js:9104:1)
nodejs_1      |     at InertRenderer._revalidate (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@ember/-internals/glimmer/index.js:9146:1)
nodejs_1      |     at invokeWithOnError (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:347:1)
nodejs_1      |     at Queue.flush (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:229:1)
nodejs_1      |     at DeferredActionQueues.flush (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:426:1)
nodejs_1      |     at Backburner._end (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:960:1)
nodejs_1      |     at Backburner.end (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:710:1)
nodejs_1      |     at Backburner._run (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:1009:1)
nodejs_1      |     at Backburner._join (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:989:1)
nodejs_1      |     at Backburner.join (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:760:1)
nodejs_1      |     at Array.loopEnd (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@ember/-internals/glimmer/index.js:8888:1)
nodejs_1      |     at Backburner._trigger (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:1084:1)
nodejs_1      |     at Backburner._end (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:979:1)
nodejs_1      |     at Backburner.end (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:710:1)
nodejs_1      |     at Backburner._run (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:1009:1)
nodejs_1      |     at Backburner._join (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:989:1)
nodejs_1      |     at Backburner.join (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:760:1)
nodejs_1      |     at Array.loopEnd (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@ember/-internals/glimmer/index.js:8888:1)
nodejs_1      |     at Backburner._trigger (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:1084:1)
nodejs_1      |     at Backburner._end (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:979:1)
nodejs_1      |     at Backburner.end (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:710:1)
nodejs_1      |     at Backburner._run (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:1009:1)
nodejs_1      |     at Backburner._join (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:989:1)
nodejs_1      |     at Backburner.join (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/backburner.js:760:1)
nodejs_1      |     at Function.join (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/@ember/runloop/index.js:168:1)
nodejs_1      |     at Object.hash.success (/tmp/broccoli-1Awdijh61s6pE/out-475-append_ember_auto_import_analyzer/assets/addon-tree-output/@ember-data/adapter/rest.js:919:1)
nodejs_1      |     at fire (/app/node_modules/jquery-deferred/lib/jquery-callbacks.js:78:30)
nodejs_1      |     at Object.fireWith (/app/node_modules/jquery-deferred/lib/jquery-callbacks.js:188:7)
nodejs_1      |     at Object.fire [as resolve] (/app/node_modules/jquery-deferred/lib/jquery-callbacks.js:195:10)
nodejs_1      |     at dataHandler (/app/node_modules/najax/lib/najax.js:167:13)
nodejs_1      |     at IncomingMessage.<anonymous> (/app/node_modules/najax/lib/najax.js:198:9)
nodejs_1      |     at IncomingMessage.emit (events.js:322:22)
nodejs_1      |     at IncomingMessage.EventEmitter.emit (domain.js:482:12)
nodejs_1      |     at endReadableNT (_stream_readable.js:1187:12)
nodejs_1      |     at processTicksAndRejections (internal/process/task_queues.js:84:21)

fastboot проверка режима как this.fastboot.isFastBoot не решает проблему и выглядит как выдача ошибки, даже если я просто импортирую @editorjs/editorjs. Может быть, кто-то сталкивался, так что готов к любой информации, чтобы получить направление для раскопок.

Пример созданного компонента:

import Component from '@ember/component';
import EditorJS from '@editorjs/editorjs';
import { inject as service } from '@ember/service';
export default Component.extend({
   fastboot: service(),
   didInsertElement() {
   if (!this.fastboot.isFastBoot) {
     const editor = new EditorJS({
    holder: this.elementId
    });
   }
   }
});

Среда :

DEBUG: -------------------------------
index.js:194 DEBUG: Ember             : 3.18.0
index.js:194 DEBUG: Ember Data        : 3.17.0
index.js:194 DEBUG: jQuery            : 3.5.0
index.js:194 DEBUG: Ember Bootstrap   : 2.8.1
index.js:194 DEBUG: -------------------------------

Обновление:

Похоже, проблема в сторонней библиотеке npm, потому что didInsertElement вообще не должна работать в fastboot

В качестве обходного пути я добавил эту библиотеку как incompatible JavaScript

app.import('vendor/fastboot-incompatible.js', {
  using: [
    {
      transformation: 'fastbootShim'
    }
  ]
});

И похоже, этот подход решает проблему. Но в любом случае, вопрос все еще актуален, потому что я хочу понять причину sh, после этой ошибки fastboot требует перезагрузки и больше не работает. Ожидаемое поведение - некоторая ошибка без общего cra sh.

...