最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Ionic 2 RC0 Property 'tz' does not exist on type 'typeof moment' - Stack Overflow

programmeradmin1浏览0评论

Recently Ionic released the RC0 of Ionic Framework and I am exciting. But I use moment-timezone and it generated an error.

I installed moment and moment-timezone like so:

npm install --save moment moment-timezone

typings install --save --global dt~moment dt~moment-timezone

Then I import moment and tz like so:

import moment from 'moment';
import 'moment-timezone';

When I run ionic build I got error:

Property 'tz' does not exist on type 'typeof moment'.

My ionic info result is:

Cordova CLI: 6.3.1
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v5.11.1
Xcode version: Xcode 7.3.1 Build version 7D1014

Someone can help me?

Thanks!

Recently Ionic released the RC0 of Ionic Framework and I am exciting. But I use moment-timezone and it generated an error.

I installed moment and moment-timezone like so:

npm install --save moment moment-timezone

typings install --save --global dt~moment dt~moment-timezone

Then I import moment and tz like so:

import moment from 'moment';
import 'moment-timezone';

When I run ionic build I got error:

Property 'tz' does not exist on type 'typeof moment'.

My ionic info result is:

Cordova CLI: 6.3.1
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v5.11.1
Xcode version: Xcode 7.3.1 Build version 7D1014

Someone can help me?

Thanks!

Share Improve this question asked Sep 29, 2016 at 21:26 Joel BanzattoJoel Banzatto 1472 silver badges9 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

You can try this:

npm install @types/moment-timezone --save

Since rc0 ionic stopped using typings and switched to @types. So delete typings folder and typings.json

Install moment typings like so

npm install @types/moment --save
发布评论

评论列表(0)

  1. 暂无评论