App compile error: Cannot find namespace 'moment'

I’ve been working on my angular 2 app yesterday and everything ran fine.
Today I was trying to npm start my app and I get this compile error:

typings/browser/ambient/moment/index.d.ts(9,21): error TS2503: Cannot find namespace 'moment'.

Although I didn’t mention anything releaeted to moment in my app!

What can cause this error if I’m not using anything releated to moment?

I tried:

  1. The solutions here
  2. npm remove moment

Any ideas?

Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
newest oldest most voted
Notify of

I had the same problem. Just fixed it.

When you run:

typings install moment --ambient --save

You’ll likely see an info message like this:

typings INFO reference Stripped reference “” during installation from “moment”

This was my clue that I also needed to install the typings for moment-node and then everything worked.

typings install moment-node --ambient --save

Good luck!