Challenges when upgrading from meteor 1.6 to meteor 1.7 | by Michael Lazarski | Medium

来源: Challenges when upgrading from meteor 1.6 to meteor 1.7 | by Michael Lazarski | Medium

Error 1: `Identifier ‘InheritPrototype’ has already been declared`

W20180702-12:59:21.872(2)? (STDERR) let InheritPrototype;
W20180702-12:59:21.872(2)? (STDERR)     ^
W20180702-12:59:21.872(2)? (STDERR) 
W20180702-12:59:21.873(2)? (STDERR) SyntaxError: Identifier 'InheritPrototype' has already been declared
W20180702-12:59:21.873(2)? (STDERR)     at createScript (vm.js:80:10)
W20180702-12:59:21.873(2)? (STDERR)     at Object.runInThisContext (vm.js:139:10)

This is one has todo with meteor packages and api modules.

You have the following in a meteor package:

api.addFiles('lib/main.js', [ 'client', 'server' ]);api.mainModule('lib/main.js', ['client', 'server']);

This will produce the error message because the same file is loaded twice.

Solution:

Most often you can just remove the api.addFiles line and everything should be okay but you have to make sure that this is really the case. Also don’t forget to bump the versionFrom to `api.versionsFrom(‘1.7’);` and your package version.

Error 2: Broken persistent session package

TypeError: Cannot read property 'apply' of undefined
 at ReactiveDict.PersistentSession.old_get (u2622_persistent-session.js?hash=57db38c11edeebc31dce68f5b5be8581c20a2286:241)
 at ReactiveDict._psGet [as get] (u2622_persistent-session.js?hash=57db38c11edeebc31dce68f5b5be8581c20a2286:244)
 at blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1934
 at Function.Template._withTemplateInstanceFunc (blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3744)
 at blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1932
 at Object.Blaze._withCurrentView (blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2271)
 at viewAutorun (blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1931)
 at Computation._compute (tracker.js:308)
 at new Computation (tracker.js:206)

This will happen when you use the u2622:persistent-session .

Solution:

meteor remove u2622:persistent-session
meteor add cultofcoders:persistent-session

Pretty easy 😉

Error 3: Missing dependencies in package.js

So it looks that with 1.7 meteor is even more strikt when it comes to package dependencies. When for example your missing _ you will no get this error:

W20180702-14:05:42.877(2)? (STDERR) TypeError: _.each is not a function

This can also happen after the meteor build was successful and when your loading the page or running functions. So i would suggest that you to a full app test after upgrading.

Solution:

You have to add _ to your package or what ever dependency is missing.

api.use([
    'ecmascript',
    'underscore',
]);

赞(0) 打赏
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏