meteor error on adding materialize package

2019-04-06 21:04发布

I just created an empty meteor app and it looks like including materialize package into meteor application by running meteor add materialize:materialize produces the following error in browser console when I start the meteor application:

Uncaught TypeError: Cannot set property 'guid' of undefined(anonymous function) @ materialize.js:2(anonymous function) @ materialize_materialize.js?dc17392a9a3ee90d7260ca5fb3f114186ddbe932:42(anonymous function) @ materialize_materialize.js?dc17392a9a3ee90d7260ca5fb3f114186ddbe932:51
global-imports.js?f3a8210e13a775671b88b311040d18b5595730c1:3 Uncaught TypeError: Cannot read property 'Materialize' of undefined(anonymous function) @ global-imports.js?f3a8210e13a775671b88b311040d18b5595730c1:3
template.test-materialize.js?db9efeb690fbdd904fe4b351652e4822e8f5d459:2 Uncaught ReferenceError: Meteor is not defined(anonymous function) @ template.test-materialize.js?db9efeb690fbdd904fe4b351652e4822e8f5d459:2(anonymous function) @ template.test-materialize.js?db9efeb690fbdd904fe4b351652e4822e8f5d459:18
test-materialize.js?c2e184d448010d8345127ffbaf10ce04b6d355e3:1 Uncaught ReferenceError: Meteor is not defined(anonymous function) @ test-materialize.js?c2e184d448010d8345127ffbaf10ce04b6d355e3:1(anonymous function) @ test-materialize.js?c2e184d448010d8345127ffbaf10ce04b6d355e3:25

2条回答
再贱就再见
2楼-- · 2019-04-06 21:13

This seems to be a new problem with the latest version of the package. Do this to fix the problem:

meteor remove materialize:materialize
meteor add materialize:materialize@=0.97.0

And see here for the GitHub issue: https://github.com/Dogfalo/materialize/issues/2043

查看更多
戒情不戒烟
3楼-- · 2019-04-06 21:35

Add the latest version of materialize via CDN in your app.js file

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.2/css/materialize.min.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.2/js/materialize.min.js"></script>

I am following this method ( atleast till the package is fixed ),& should work just fine for you needs.

查看更多
登录 后发表回答