繁体   English   中英

在客户端要求(节点模块给出了dep错误)

[英]require on client side (node module gives a dep error)

我正在尝试使用browserify将我的js捆绑到一个文件中,并能够在客户端使用require。

但是每次我运行browserify或在app.js上观看时,我都会从i18next模块收到错误消息。

Error: Cannot find module 'jquery' from '/home/js/testapp/node_modules/i18next/lib/dep'

我已经检查过i18next,它不需要jquery(如果它不可用)(运行服务器时没有错误)。

我尝试安装jquery,该问题消失了,但其他问题又出现了:

/home/js/testapp/node_modules/i18next/lib/dep/i18next.js:1245
        $.fn.i18n = function (options) {
                  ^
TypeError: Cannot set property 'i18n' of undefined

我在这里想念什么?

谢谢

似乎需要禁用jQuery。

在i18n init中添加了一个配置(在文档中: http : //i18next.com/pages/doc_jquery.html

setJqueryExt: false

现在我有了这个配置,没有错误

app.use(i18n.handle);

i18n.init({
    cookieName: 'lang',
    fallbackLng: 'en',
    debug: 'true',
    setJqueryExt: false
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM