ember.js 3.6.1注入一种未知的ember注射剂:升级后的'service:-document'

egdjgwm8  于 2022-11-05  发布在  其他
关注(0)|答案(1)|浏览(128)

因此,我目前正在尝试更新我的EmberJS应用程序,它最初是在3.0.2版本上。首先,我已经在3.2上运行了该应用程序。然后,我进一步升级,在我的浏览器控制台中出现了Error: Assertion Failed: Attempting to inject an unknown injection: 'service:-document'
应用程序使用ember serve成功构建,但我只得到一个白色旁边的这个错误,堆栈跟踪也是绝对无用的。唯一提到这样的错误是一个github问题上的ember-wormhole的方式旧的ember版本,我甚至没有在我的应用程序中使用这个插件。我也意识到,应用程序死亡后,app.js被执行,但没有我的初始化得到调用。
package.json:

"devDependencies": {
    "@babel/plugin-transform-block-scoping": "^7.8.3",
    "@sentry/browser": "^5.6.3",
    "@sentry/integrations": "^5.6.1",
    "broccoli-asset-rev": "^2.7.0",
    "ember-ajax": "^3.1.0",
    "ember-array-contains-helper": "^2.0.0",
    "ember-auto-import": "1.3.0",
    "ember-bootstrap": "^3.1.1",
    "ember-bootstrap-datepicker": "^2.0.1",
    "ember-changeset": "^2.2.4",
    "ember-changeset-validations": "^2.2.1",
    "ember-cli": "~3.6.1",
    "ember-cli-active-link-wrapper": "^0.5.0",
    "ember-cli-app-version": "^3.2.0",
    "ember-cli-babel": "^7.1.2",
    "ember-cli-code-coverage": "^0.4.1",
    "ember-cli-dependency-checker": "^3.0.0",
    "ember-cli-dependency-lint": "^1.0.2",
    "ember-cli-eslint": "^4.2.3",
    "ember-cli-htmlbars": "^4.2.2",
    "ember-cli-icon-rating": "^2.0.1",
    "ember-cli-inject-live-reload": "^1.8.2",
    "ember-cli-page-object": "^1.11.0",
    "ember-cli-sass": "^7.0.0",
    "ember-cli-sticky": "^0.6.4",
    "ember-cli-string-helpers": "^2.0.0",
    "ember-cli-template-lint": "^1.0.0-beta.1",
    "ember-cli-uglify": "^2.1.0",
    "ember-collapsible-panel": "^3.2.1",
    "ember-composable-helpers": "^2.0.1",
    "ember-confirm-dialog": "^1.3.0",
    "ember-countries": "^2.0.2",
    "ember-data": "~3.6.0",
    "ember-form-for-intl": "^1.0.6",
    "ember-i18n-iso-countries": "^1.5.0",
    "ember-keyboard": "^4.0.0",
    "ember-keycloak-auth": "~0.3.0",
    "ember-load-initializers": "^2.1.1",
    "ember-moment": "8.0.0",
    "ember-notify": "^5.2.0",
    "ember-pikaday": "2.4.1",
    "ember-power-select-with-create": "^0.6.0",
    "ember-qunit": "^3.4.1",
    "ember-resolver": "~5.3.0",
    "ember-route-action-helper": "^2.0.3",
    "ember-source": "~3.6.0",
    "ember-toggle": "^5.3.2",
    "eslint-config-prettier": "^4.3.0",
    "eslint-plugin-ember": "^5.2.0",
    "eslint-plugin-prettier": "^3.1.0",
    "husky": "^2.3.0",
    "keycloak-js": "^8.0.1",
    "lint-staged": "^8.1.7",
    "loader.js": "^4.7.0",
    "prettier": "1.17.1",
    "qunit-dom": "^0.8.0",
    "ui-ember-slider": "github:ifad/ui-slider",
    "watchman": "^1.0.0"
  },
  "engines": {
    "node": "6.* || 8.* || >= 10.*"
  },
  "dependencies": {
    "@babel/core": "7.8.4",
    "bootstrap": "^4.3.1",
    "bootstrap-slider": "^10.6.1",
    "ember-cli-update": "^0.27.1",
    "ember-intl": "^4.2.3",
    "global": "^4.4.0",
    "jquery": "^3.4.1",
    "npm": "^5.7.1",
    "popper.js": "^1.16.0",
    "to": "^0.2.9",
    "update": "^0.7.4"
  }

app.js:

import Application from "@ember/application";
import RSVP from "rsvp";
import Resolver from "./resolver";
import loadInitializers from "ember-load-initializers";
import config from "./config/environment";
import $ from "jquery";

window.Promise = RSVP.Promise;

const App = Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver
});

$.getJSON("/api/env_settings", function(envSettings) {
  config.sentryDsn = envSettings.sentry;
  config.keycloak.url = envSettings.keycloak.url;
  config.keycloak.realm = envSettings.keycloak.realm;
  config.keycloak.clientId = envSettings.keycloak.clientId;
  config.keycloak.secret = envSettings.keycloak.secret;
  config.helplink = envSettings.helplink;
  config.keycloak.disable = envSettings.keycloak.disable;
});

loadInitializers(App, config.modulePrefix);
export default App;

你知道这个问题的原因在哪里吗?

快速更新:

我也尝试过将我的应用程序直接升级到3.15.2,这导致了同样的错误...

其他更新:

堆栈跟踪如下所示:

Error: Assertion Failed: Attempting to inject an unknown injection: 'service:-document' vendor.js:54143:15
    assert http://localhost:4200/assets/vendor.js:54143
    validateInjections http://localhost:4200/assets/vendor.js:17702
    processInjections http://localhost:4200/assets/vendor.js:16916
    buildInjections http://localhost:4200/assets/vendor.js:16956
    injectionsFor http://localhost:4200/assets/vendor.js:16970
    create http://localhost:4200/assets/vendor.js:17036
    instantiateFactory http://localhost:4200/assets/vendor.js:16896
    _lookup http://localhost:4200/assets/vendor.js:16828
    processInjections http://localhost:4200/assets/vendor.js:16936
    buildInjections http://localhost:4200/assets/vendor.js:16956
    injectionsFor http://localhost:4200/assets/vendor.js:16970
    create http://localhost:4200/assets/vendor.js:17036
    instantiateFactory http://localhost:4200/assets/vendor.js:16896
    _lookup http://localhost:4200/assets/vendor.js:16828
    processInjections http://localhost:4200/assets/vendor.js:16936
    buildInjections http://localhost:4200/assets/vendor.js:16952
    injectionsFor http://localhost:4200/assets/vendor.js:16970
    create http://localhost:4200/assets/vendor.js:17036
    instantiateFactory http://localhost:4200/assets/vendor.js:16896
    _lookup http://localhost:4200/assets/vendor.js:16828
    lookup http://localhost:4200/assets/vendor.js:16666
    lookup http://localhost:4200/assets/vendor.js:45312
    getDOM http://localhost:4200/assets/vendor.js:163053
    updateDocumentLanguage http://localhost:4200/assets/vendor.js:163000
    set http://localhost:4200/assets/vendor.js:162810
    _set http://localhost:4200/assets/vendor.js:34139
    set http://localhost:4200/assets/vendor.js:34080
    CPSETTER_FUNCTION http://localhost:4200/assets/vendor.js:31584
    _set2 http://localhost:4200/assets/vendor.js:33493
    setLocale http://localhost:4200/assets/vendor.js:162946
    init http://localhost:4200/assets/vendor.js:162862
    superWrapper http://localhost:4200/assets/vendor.js:48884
    initialize http://localhost:4200/assets/vendor.js:47083
    create http://localhost:4200/assets/vendor.js:47667
    create http://localhost:4200/assets/vendor.js:17092
    instantiateFactory http://localhost:4200/assets/vendor.js:16896
    _lookup http://localhost:4200/assets/vendor.js:16828
    lookup http://localhost:4200/assets/vendor.js:16666
    initialize http://localhost:4200/assets/frontend.js:8767
    runInitializers http://localhost:4200/assets/vendor.js:54873
    each http://localhost:4200/assets/vendor.js:73443
    walk http://localhost:4200/assets/vendor.js:73357
    each http://localhost:4200/assets/vendor.js:73287
    topsort http://localhost:4200/assets/vendor.js:73295
    _runInitializer http://localhost:4200/assets/vendor.js:54899
    runInitializers http://localhost:4200/assets/vendor.js:54871
    _bootSync http://localhost:4200/assets/vendor.js:53180
    domReady http://localhost:4200/assets/vendor.js:53080
    _run http://localhost:4200/assets/vendor.js:72991
    _join http://localhost:4200/assets/vendor.js:72967
    join http://localhost:4200/assets/vendor.js:72684
    join http://localhost:4200/assets/vendor.js:59338
    bind http://localhost:4200/assets/vendor.js:59442
    mightThrow http://localhost:4200/assets/vendor.js:9158
    process http://localhost:4200/assets/vendor.js:9226

使用ember-inspector的工作3.2版本的应用程序,我试图找到服务:-document下的容器在服务的ember-inspector.我很遗憾不能找到服务...

lmyy7pcs

lmyy7pcs1#

正如@Lux所说,stacktrace是枢纽点。有一个ember-form-for-intlinitialize函数的调用,在那个版本上是坏的。因此我只是删除了它,让它工作。
非常感谢!!

相关问题