安卓打包配置项压缩--prod报错
电脑版发表于:2020/7/6 10:23
报错信息:Cannot find type definition file for'@typeds'
当我尝试使用命令'ionic cordova build android --prod --release'在android中构建应用程序时,它在Windows上正常工作
在ios中使用相同命令(在Mac上)对接,给我这个错误:
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 TypeScriptat 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 ELIFECYCLEnpm ERR! errno 1npm ERR! transatour@0.0.1 build:prod:ios: `cross-env NODE_OPTIONS='- -max-old-space-size=8192' ionic cordova build ios --prod --release`npm ERR! Exit status 1npm ERR! npm ERR! Failed at the transatour@0.0.1 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
在package.json配置文件中修改@ ionic / app-scripts版本并且把版本号前面的^符号去掉 表示不安装最新版只安装当前版本,prod打包只支持3.2.3版本
修改版本命令:
npm i @ionic/app-scripts@3.2.3
安装成功后再次npm install安装一下环境就可以了