Chawki Tazzi
Chawki Tazzi

Reputation: 245

Cannot find type definition file for '@types'

so i'm building an ionic application for android and ios devices.

when i'm trying to build application in android with command 'ionic cordova build android --prod --release', it works fine in (on windows)

butt in ios with the same command (on mac), gives me this error:

10:35:55]  typescript error 
        Cannot find type definition file for '@types'. 

[10:35:55]  ionic-app-script task: "build" 
[10:35:55]  Error: Failed to transpile TypeScript 
Error: Failed to transpile TypeScript
at errorCheckProgram (/Users/zakaria/Desktop/untitled 
folder/transatour/node_modules/@ionic/app-scripts/dist/aot/aot- 
compiler.js:119:39)
at Object.<anonymous> (/Users/zakaria/Desktop/untitled 
folder/transatour/node_modules/@ionic/app-scripts/dist/aot/aot- 
compiler.js:89:21)
at step (/Users/zakaria/Desktop/untitled 
folder/transatour/node_modules/@ionic/app-scripts/dist/aot/aot- 
compiler.js:32:23)
at Object.next (/Users/zakaria/Desktop/untitled 
folder/transatour/node_modules/@ionic/app-scripts/dist/aot/aot- 
compiler.js:13:53)
at fulfilled (/Users/zakaria/Desktop/untitled 
folder/transatour/node_modules/@ionic/app-scripts/dist/aot/aot- 
compiler.js:4:58)
[ERROR] An error occurred while running subprocess ionic-app- 
scripts.

    ionic-app-scripts build --prod --target cordova --platform ios 
 exited with exit code 1.

    Re-running this command with the --verbose flag may provide 
more information.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:prod:ios: `cross-env 
NODE_OPTIONS='- 
-max-old-space-size=8192' ionic cordova build ios --prod --release`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:prod:ios script.
npm ERR! This is probably not a problem with npm. There is likely 
additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/zakaria/.npm/_logs/2019-06-03T11_35_55_786Z- 
 debug.log

Upvotes: 20

Views: 9552

Answers (4)

jeiea
jeiea

Reputation: 2405

Just for future reference.

I had the "include": [...] in my package.json, and the issue was resolved when I removed it.

Upvotes: 0

faus
faus

Reputation: 356

This error showed up after upgrading @ionic/app-scripts: 3.2.3 to latest version 3.2.4.

I did not downgrade to fix it

I added

"types": [],

into

"compilerOptions"

in tsconfig.json file and the error was gone.

Now my tsconfig.json file looks like this:

"compilerOptions": {
    "types": [],  <== fix added here <==
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  }

Upvotes: 23

Downgrade the @ionic/app-scripts version to 3.2.3 is worked for me.

 npm i @ionic/[email protected]

Upvotes: 8

Steven Carlton
Steven Carlton

Reputation: 444

Make sure you are using the latest version of @ionic/app-scripts in your package.json. I had this error and moving to the latest version resolved it.

Upvotes: 0

Related Questions