# Cannot find type definition file for '@types'

**URL:** <https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794>\
**Category:** ionic-v3\
**Created:** [May 26, 2019, 9:42pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794 "2019-05-26T21:42:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomwest1980](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@tomwest1980](https://forum.ionicframework.com/u/tomwest1980)\
**Post date:** [May 26, 2019, 9:42pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/1 "2019-05-26T21:42:12Z")

</div>

Hi,

I am trying to build my app with the --prod flag.

`ionic cordova build android --verbose --prod`

However, when I do, I get the error:

```auto
typescript error 
            Cannot find type definition file for '@types'. 

[17:12:58] ionic-app-script task: "build" 
[17:12:58] Error: Failed to transpile TypeScript 
Error: Failed to transpile TypeScript

```

The app builds fine in release, but not prod.

Any ideas would be appreciated.

---

<div class="post-metadata">

**Author:** ![jylikorpi](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@jylikorpi](https://forum.ionicframework.com/u/jylikorpi)\
**Post date:** [May 27, 2019, 5:57am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/2 "2019-05-27T05:57:40Z")

</div>

Are you missing @types altogether on your project?

> **[@types/npm](https://www.npmjs.com/package/@types/npm)**
>
> TypeScript definitions for npm

---

<div class="post-metadata">

**Author:** ![jspblm](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jspblm/32/126045_2.png) [@jspblm](https://forum.ionicframework.com/u/jspblm)\
**Post date:** [May 27, 2019, 6:15am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/3 "2019-05-27T06:15:19Z")

</div>

I have the same error now, but yesterday the build --prod was working ☹

---

<div class="post-metadata">

**Author:** ![nadiapp](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@nadiapp](https://forum.ionicframework.com/u/nadiapp)\
**Post date:** [May 27, 2019, 8:15am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/4 "2019-05-27T08:15:42Z")

</div>

Same error here… we changed nothing and this error popped up on friday 😕

---

<div class="post-metadata">

**Author:** ![Justkog](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Justkog](https://forum.ionicframework.com/u/Justkog)\
**Post date:** [May 27, 2019, 9:23am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/5 "2019-05-27T09:23:45Z")

</div>

Hi,

ionic-app-script was recently updated producing this error.

As a workaround, you can lock its version in your package.json to the last working one:

`"@ionic/app-scripts": "3.2.3",`

---

<div class="post-metadata">

**Author:** ![nadiapp](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@nadiapp](https://forum.ionicframework.com/u/nadiapp)\
**Post date:** [May 27, 2019, 10:28am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/6 "2019-05-27T10:28:59Z")

</div>

Thank you! That solved my error! 🤗

---

<div class="post-metadata">

**Author:** ![tomwest1980](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@tomwest1980](https://forum.ionicframework.com/u/tomwest1980)\
**Post date:** [May 28, 2019, 8:36pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/7 "2019-05-28T20:36:38Z")

</div>

Ah, great thanks. This has sorted the issue. Shame the package testing isn’t up to scratch…

---

<div class="post-metadata">

**Author:** ![luciojb](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/luciojb/32/114535_2.png) [@luciojb](https://forum.ionicframework.com/u/luciojb)\
**Post date:** [June 24, 2019, 9:30pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/8 "2019-06-24T21:30:25Z")

</div>

Noting that it won’t work globally, so `npm i @ionic/app-scripts@3.2.3` only should work =)

---

<div class="post-metadata">

**Author:** ![ghonche-yqr](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ghonche-yqr/32/123089_2.png) [@ghonche-yqr](https://forum.ionicframework.com/u/ghonche-yqr)\
**Post date:** [June 25, 2019, 7:30am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/9 "2019-06-25T07:30:27Z")

</div>

it worked for me.  
the problems i spent days on, solved! thank you

---

<div class="post-metadata">

**Author:** ![ghonche-yqr](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ghonche-yqr/32/123089_2.png) [@ghonche-yqr](https://forum.ionicframework.com/u/ghonche-yqr)\
**Post date:** [June 25, 2019, 7:32am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/10 "2019-06-25T07:32:40Z")

</div>

just editing the package.json didn’t change anything.  
i ran `npm i @ionic/app-scripts@3.2.3` command and it solved.  
thanks to @luciojb

---

<div class="post-metadata">

**Author:** ![sbrazell](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sbrazell/32/127206_2.png) [@sbrazell](https://forum.ionicframework.com/u/sbrazell)\
**Post date:** [June 27, 2019, 5:32am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/11 "2019-06-27T05:32:03Z")

</div>

Better still, you can use the latest app scripts still if you add this to your `tsconfig.json` file:

```auto
{
  "compilerOptions": {
    ...
    "types": [
      "node"
    ]
  },
  ...
}

```

This might depend on your project @types but give it a go, worked for me.

---

<div class="post-metadata">

**Author:** ![fdambrosio](https://avatars.discourse-cdn.com/v4/letter/f/f6c823/32.png) [@fdambrosio](https://forum.ionicframework.com/u/fdambrosio)\
**Post date:** [July 6, 2019, 12:19pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/12 "2019-07-06T12:19:07Z")

</div>

thanks it works fine

---

<div class="post-metadata">

**Author:** ![diego6545](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@diego6545](https://forum.ionicframework.com/u/diego6545)\
**Post date:** [July 14, 2019, 2:43pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/13 "2019-07-14T14:43:32Z")

</div>

Gracias esto resolvio mi problema, no olviden luego de actualizar el packge.json hacer `npm install`

---

<div class="post-metadata">

**Author:** ![mottolini](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mottolini](https://forum.ionicframework.com/u/mottolini)\
**Post date:** [July 15, 2019, 11:22am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/14 "2019-07-15T11:22:39Z")

</div>

Think this is the way to go. It worked for me without locking to an older version of app-script

---

<div class="post-metadata">

**Author:** ![acner](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/acner/32/122274_2.png) [@acner](https://forum.ionicframework.com/u/acner)\
**Post date:** [August 13, 2019, 6:54pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/15 "2019-08-13T18:54:35Z")

</div>

it works for me…!

---

<div class="post-metadata">

**Author:** ![sebafra](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sebafra/32/113464_2.png) [@sebafra](https://forum.ionicframework.com/u/sebafra)\
**Post date:** [August 16, 2019, 10:32pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/16 "2019-08-16T22:32:41Z")

</div>

> [@sbrazell](#):
>
> “types”: [“node”]

i get the following error:

```auto
typescript error
            Cannot find type definition file for 'node'.

```

---

<div class="post-metadata">

**Author:** ![sbrazell](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sbrazell/32/127206_2.png) [@sbrazell](https://forum.ionicframework.com/u/sbrazell)\
**Post date:** [August 16, 2019, 11:07pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/17 "2019-08-16T23:07:20Z")

</div>

It seems you don’t have the `@types/node` type definitions in your project, I didn’t expressly install them on mine either, I assumed they were one of Ionic’s dependencies, maybe run `npm i` and try run it again after that to make sure they’re installed.

Edit - I believe `@types/node` is one of the `app-scripts` dependencies.

---

<div class="post-metadata">

**Author:** ![sebafra](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sebafra/32/113464_2.png) [@sebafra](https://forum.ionicframework.com/u/sebafra)\
**Post date:** [August 16, 2019, 11:49pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/18 "2019-08-16T23:49:15Z")

</div>

> [@ghonche-yqr](#):
>
> npm i @ionic/app-scripts@3.2.3

Thanks, works with npm i @ionic/app-scripts@3.2.3

---

<div class="post-metadata">

**Author:** ![sbrazell](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sbrazell/32/127206_2.png) [@sbrazell](https://forum.ionicframework.com/u/sbrazell)\
**Post date:** [August 17, 2019, 12:35am UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/19 "2019-08-17T00:35:33Z")

</div>

Should work with latest, must be something different between your project and mine.

---

<div class="post-metadata">

**Author:** ![hodes](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hodes/32/128063_2.png) [@hodes](https://forum.ionicframework.com/u/hodes)\
**Post date:** [September 3, 2019, 2:36pm UTC](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794/20 "2019-09-03T14:36:10Z")

</div>

Like @sbrazell I don’t think downgrading is the option. Many thanks @sbrazell!  
My project uses several types like:

```auto
"devDependencies": {
        "@ionic/app-scripts": "^3.2.4",
        "@types/crypto-js": "^3.1.43",
        "@types/jquery": "^3.3.31",
        "@types/moment-timezone": "^0.5.12",
        ...
},

```

I had the problem described in this topic with the version 3.2.4 of the app-scripts.  
Fixed by adding to the types definition, but still reference them on devDependencies as above, and it worked. My types look like this:

```auto
"types": [
    "crypto-js",
    "jquery",
    "moment-timezone"
],

```

ps: jQuery hmmmm eclectic project. but still works with this fix.

[Next page](https://forum.ionicframework.com/t/cannot-find-type-definition-file-for-types/164794.md?page=2)
