Meteor app中的'jQuery未定义'?

时间:2015-07-19 18:58:18

标签: javascript node.js macos meteor

在下载semantic-ui后似乎得到一个奇怪的错误,当我选择我做的事情并且不想在我的custom.semantic.json文件中时,我无法运行它。我也尝试过将jQuery包下载/安装到我的目录中,没有任何乐趣。错误信息如下。

>/Users/Kyle/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
                        throw(ex);
                              ^

> ReferenceError: jQuery is not defined
>     at app/definitions/behaviors/api.js:1081:5
>     at app/definitions/behaviors/api.js:1083:3
>     at /Users/Kyle/Desktop/portfolio/.meteor/local/build/programs/server/boot.js:222:10
>     at Array.forEach (native)
>     at Function._.each._.forEach (/Users/Kyle/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
>     at /Users/Kyle/Desktop/portfolio/.meteor/local/build/programs/server/boot.js:117:5
> Exited with code: 8 Your application is crashing. Waiting for file
> change.

1 个答案:

答案 0 :(得分:10)

在Meteor中,当custom.semantic.json位于根lib/文件夹中时会发生这种情况。因此,Semantic-UI会在lib/中生成所有文件夹和文件,这些文件夹和文件在之前加载其任何核心依赖项,例如jQuery。

解决方案是将custom.semantic.json放入应用文件夹,例如client/lib/semantic-ui/