Cannot find type definition file for '@types'


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:

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.


Are you missing @types altogether on your project?

1 Like

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

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


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",


Thank you! That solved my error! :hugs:

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

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


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

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


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

  "compilerOptions": {
    "types": [

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


thanks it works fine

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

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

1 Like

it works for me…!

i get the following error:

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

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.

1 Like

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

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

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

"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:

"types": [

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