5

I downloaded .NET Core & ReactJS template from aspnetboilerplate.com .

I initialized the db.

In reactjs folder, I ran npm install and npm start commands.

I get this error:

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

I tried these :

  • Delete node_modules folder and run npm install and npm start commands
  • npm i @types/moment-timezone --save-dev
  • npm i @types/moment-timezone --save

How can I start this project?

emert117
  • 1,268
  • 2
  • 20
  • 38

2 Answers2

8

@types/moment-timezone has been deprecated. Try the following:

  1. npm uninstall @types/moment-timezone

  2. Using the following code:

import * as moment from 'moment';
import 'moment-timezone';

Also, take a look at the issue on GitHub

Antonio Erdeljac
  • 2,974
  • 1
  • 17
  • 24
0

You have to download another package for tz.

npm i moment-timezone

and import both like this

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