我正在尝试runkit.com中的一个组件。从图像中可以看出,平台告诉我......
修复:使用全局而不是窗口。 RunKit是一个节点环境,因此窗口和其他浏览器功能将不存在。如果您只是尝试访问全局对象,则可以简单地使用全局对象。
这是粘贴的代码:
var window = {};
const QueryQl = require("queryfilters/queryql")
var q = new QueryQl();
q.json({
'ciao': 'mondo'
});
q.getQueryString();
我该如何解决这个问题?
答案 0 :(得分:1)
修复很简单。只需替换此
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/glassfish/web/loader/WebappClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/glassfish/javaee/full/deployment/EarLibClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:418)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
用这个:
window.module = window.module || {};
在模块中。
答案 1 :(得分:0)
尝试定义全局窗口,在调用模块之前:
global.window = {}