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:
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.
2 Likes
Are you missing @types altogether on your project?
1 Like
I have the same error now, but yesterday the build --prod was working
Same error here… we changed nothing and this error popped up on friday
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",
25 Likes
Thank you! That solved my error!
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 =)
7 Likes
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
6 Likes
Better still, you can use the latest app scripts still if you add this to your tsconfig.json
file:
{
"compilerOptions": {
...
"types": [
"node"
]
},
...
}
This might depend on your project @types but give it a go, worked for me.
21 Likes
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
sebafra
August 16, 2019, 10:32pm
16
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
sebafra
August 16, 2019, 11:49pm
18
Thanks, works with npm i @ionic /app-scripts@3.2.3
Should work with latest, must be something different between your project and mine.
hodes
September 3, 2019, 2:36pm
20
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": [
"crypto-js",
"jquery",
"moment-timezone"
],
ps: jQuery hmmmm eclectic project. but still works with this fix.
3 Likes