我在我的流星項目中使用了momentjs:moment包。客戶端moment(new Date())
通話效果很好。如果我在服務器端執行相同的調用,或者如果我在console.log(moment(new Date()));
中包裝相同的調用,則會在此問題底部收到錯誤消息。Momentjs與流星似乎並沒有在服務器端工作
如果我運行meteor shell
,然後moment(new Date());
我也收到一個錯誤(moment is not defined
)。但是,如果從外殼,我把它包裝在一個console.log(moment(new Date()));
它工作正常,並打印出來的控制檯。
任何想法我忘記了什麼,或者我不在這裏做什麼?
W20150318-19:55:45.885(-5)? (STDERR) TypeError: Property 'moment' of object #<Object> is not a function
W20150318-19:55:45.885(-5)? (STDERR) at Object._.extend.send_donation_email (app/server/methods/mandrill.js:37:25)
W20150318-19:55:45.885(-5)? (STDERR) at Object.Stripe_Events.charge.succeeded (app/server/lib/stripe_events.js:55:23)
W20150318-19:55:45.885(-5)? (STDERR) at [object Object].Router.route.where (app/both/router/router.js:238:48)
W20150318-19:55:45.885(-5)? (STDERR) at boundNext (packages/iron:middleware-stack/lib/middleware_stack.js:251:1)
W20150318-19:55:45.885(-5)? (STDERR) at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
W20150318-19:55:45.885(-5)? (STDERR) at packages/meteor/dynamics_nodejs.js:121:1
W20150318-19:55:45.885(-5)? (STDERR) at [object Object].urlencodedParser (/Users/Bechard/.meteor/packages/iron_router/.1.0.7.1oysnq2++os+web.browser+web.cordova/npm/node_modules/body-parser/lib/types/urlencoded.js:69:27)
W20150318-19:55:45.885(-5)? (STDERR) at packages/iron:router/lib/router.js:277:1
W20150318-19:55:45.885(-5)? (STDERR) at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
W20150318-19:55:45.885(-5)? (STDERR) at [object Object].hookWithOptions (packages/iron:router/lib/router.js:276:1)
W20150318-19:55:45.885(-5)? (STDERR) at boundNext (packages/iron:middleware-stack/lib/middleware_stack.js:251:1)
W20150318-19:55:45.885(-5)? (STDERR) at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
**更新:流星1.1仍然有這個問題。 **
我縮小了它似乎工作的原因,然後停止工作。如果我的應用程序遇到錯誤,而沒有捕獲它,那麼時刻就會停止工作。爲了測試這一點,我開始了流星,然後流星殼和瞬間(),它的工作。然後我得到我的應用程序調用一個不存在的函數,它總是拋出類似下面的錯誤。然後,我再次從Meteor Shell運行時刻(),此時刻()不起作用。如果我重新啓動流星,它仍然不起作用。我重新啓動了電腦,但仍然無法工作。
(STDERR) TypeError: Property 'customer.source.updated' of object #<Object> is not a function
W20150401-13:46:11.812(-5)? (STDERR) at [object Object].Router.route.where (app/both/router/router.js:254:48)
W20150401-13:46:11.812(-5)? (STDERR) at boundNext (packages/iron:middleware-stack/lib/middleware_stack.js:251:1)
W20150401-13:46:11.812(-5)? (STDERR) at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
W20150401-13:46:11.812(-5)? (STDERR) at packages/meteor/dynamics_nodejs.js:121:1
W20150401-13:46:11.812(-5)? (STDERR) at [object Object].urlencodedParser (/Users/Bechard/.meteor/packages/iron_router/.1.0.7.1oysnq2++os+web.browser+web.cordova/npm/node_modules/body-parser/lib/types/urlencoded.js:69:27)
W20150401-13:46:11.812(-5)? (STDERR) at packages/iron:router/lib/router.js:277:1
W20150401-13:46:11.812(-5)? (STDERR) at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
W20150401-13:46:11.812(-5)? (STDERR) at [object Object].hookWithOptions (packages/iron:router/lib/router.js:276:1)
W20150401-13:46:11.812(-5)? (STDERR) at boundNext (packages/iron:middleware-stack/lib/middleware_stack.js:251:1)
W20150401-13:46:11.813(-5)? (STDERR) at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
我沒有遇到'momentjs:moment'和1.0.4.1這個問題,但是我有時在改變'packages'文件中的包序列方面取得了成功。每個包應該聲明其依賴關係,但永遠不會少... – dalgard 2015-03-20 22:17:35