How to solve app script issue


#1

How to solve this when i run below command

ionic cordova build android --prod

Error: Cannot find module 'D:\kdIonic\ejohri\node_modules@ionic\app-scripts’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (D:\kdIonic\ejohri\node_modules\ionic\node_modules@io
nic\cli-utils\lib\ionic-angular\utils.js:39:16)
at next (native)
at D:\kdIonic\ejohri\node_modules\tslib\tslib.js:96:75
at Object.__awaiter (D:\kdIonic\ejohri\node_modules\tslib\tslib.js:92:16)
at Object.importAppScripts (D:\kdIonic\ejohri\node_modules\ionic\node_module
s@ionic\cli-utils\lib\ionic-angular\utils.js:37:20)
at D:\kdIonic\ejohri\node_modules\ionic\node_modules@ionic\cli-utils\lib\io
nic-angular\build.js:10:42


#2

This shouldn’t happen. Run npm install.

And post your ionic info output please.


#3

My ionic info :-

cli packages: (D:\ej\ejohri-spare\node_modules)

@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:

cordova (Cordova CLI) : 7.0.1
local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.6.1
System:

Android SDK Tools : 26.1.1
Node : v6.10.3
npm : 5.4.2
OS : Windows 7
Misc:

backend : legacy
My Angular Version:

@angular/cli: 1.4.3
node: 6.10.3
os: win32 x64
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/compiler-cli: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/cli: 1.4.3
typescript: 2.5.2

when i run ionic cordova build android --prod

I got this error:-1:
[INFO] Running app-scripts build: --prod --platform android --target cordova

[15:02:34] build prod started …
[15:02:34] clean started …
[15:02:34] clean finished in 2 ms
[15:02:34] copy started …
[15:02:34] ngc started …
[15:02:51] ngc finished in 16.87 s
[15:02:51] preprocess started …
[15:02:51] deeplinks started …
Error: The RegExp to find the DeepLinkConfigToken did not return valid data
at BuildError.Error (native)
at new BuildError (D:\ej\ejohri-spare\node_modules@ionic\app-scripts\dist\u
til\errors.js:16:28)
at D:\ej\ejohri-spare\node_modules@ionic\app-scripts\dist\preprocess.js:18:
21


#4

That is a very different error than oyu posted first. Why is it different now?

This is outdated and should be updated.


#5

I want to say that after your post i run npm install command so my old error removed
then i run ionic cordova build android --prod

so i got latest error

and how to update app-script to latest


#6

npm install @ionic/app-scripts, but read the change log for possible breaking changes.


#7

Hi, @Sujan12

I run npm install @ionic/app-scripts

i got error like

ENV is not defined


#8

Post the exact error please.
What is your ionic info now?


#9

Hi, @Sujan12

after googling

i set dev.json and prod.json file so
ENV is not defined error gone

my Ionic Info:-

cli packages: (D:\ej\ejohri-spare\node_modules)

@ionic/cli-utils  : 1.12.0
ionic (Ionic CLI) : 3.12.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.6.1

System:

Android SDK Tools : 26.1.1
Node              : v6.10.3
npm               : 5.4.2
OS                : Windows 7

Misc:

backend : legacy

but when i run ionic cordova build android --prod
i got following error

[INFO] Running app-scripts build: --prod --platform android --target cordova

[16:11:49] build prod started …
[16:11:49] clean started …
[16:11:49] clean finished in 10 ms
[16:11:49] copy started …
[16:11:49] ngc started …
[16:12:05] ngc finished in 16.08 s
[16:12:05] preprocess started …
[16:12:05] deeplinks started …
Error: The RegExp to find the DeepLinkConfigToken did not return valid data
at BuildError.Error (native)
at new BuildError (D:\ej\ejohri-spare\node_modules@ionic\app-scripts\dist\u
til\errors.js:16:28)
at D:\ej\ejohri-spare\node_modules@ionic\app-scripts\dist\preprocess.js:18:
21


#10

This isn’t updated. You can also chaneg the version in package.json and then run npm install.


#11

HI, @Sujan12

Thank you so much

you gave me proper solution for my problem

Thank you once again


#13

I have similar type of issue while creating build for PROD. Is anyone help to get resolve? Below are details

10-140-59-62:mobileapp $ ionic info

cli packages: (/…/…/Documents/projects/mobileapp/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 6.5.0 

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.5.1

System:

Node  : v6.10.3
npm   : 3.10.10 
OS    : macOS Sierra
Xcode : Xcode 9.0 Build version 9A235 

10-140-59-62:mobileapp $ sudo ionic cordova build android --prod
[WARN] Detected @ionic/cli-plugin-cordova in your package.json.

   As of CLI 3.8, it is no longer needed. You can uninstall it:
   
   npm uninstall --save-dev --save-exact @ionic/cli-plugin-cordova

[WARN] Detected @ionic/cli-plugin-ionic-angular in your package.json.

   As of CLI 3.8, it is no longer needed. You can uninstall it:
   
   npm uninstall --save-dev --save-exact @ionic/cli-plugin-ionic-angular

[INFO] Running app-scripts build: --prod --platform android --target cordova

[14:16:05] build prod started …
[14:16:05] clean started …
[14:16:05] clean finished in 1 ms
[14:16:05] copy started …
[14:16:05] ngc started …
Error: Cannot determine the module for class OverlayPortal in /Users/mobileapp/node_modules/ionic-angular/umd/components/app/overlay-portal.d.ts! Add OverlayPortal to the NgModule to fix it.

Cannot determine the module for class IonicApp in /Users/node_modules/ionic-angular/umd/components/app/app-root.d.ts! Add IonicApp to the NgModule to fix it.

Cannot determine the module for class ClickBlock in /User/node_modules/ionic-angular/umd/components/app/click-block.d.ts! Add ClickBlock to the NgModule to fix it.

Cannot determine the module for class OverlayPortal in /Users/mobileapp/node_modules/ionic-angular/es2015/components/app/overlay-portal.d.ts! Add OverlayPortal to the NgModule to fix it.

Cannot determine the module for class IonicApp in /Users/mobileapp/node_modules/ionic-angular/es2015/components/app/app-root.d.ts! Add IonicApp to the NgModule to fix it.

Cannot determine the module for class ClickBlock in /Users/mobileapp/node_modules/ionic-angular/es2015/components/app/click-block.d.ts! Add ClickBlock to the NgModule to fix it.


#14

Have you tried the aforementioned solution of updating ionic-app-scripts?

It’s also a good idea to refrain from using sudo with Ionic, as it tends to lead to permissions heartache.


#15

I’m facing the same issue. Did you achieve to solve it ?


#16

Same issue. Any solution?


#17

Please post your ionic info output and the complete error message you are getting.


#19

i am facing same issue please Help

Error :

$ ionic serve
Error: Cannot find module 'E:\myapp_dwai\myapp_dwai_ap\node_modules\@ionic\app-scripts'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\Mehroz\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\cli-utils\lib\ionic-angular\app-scripts.js:9:16)    at Generator.next (<anonymous>)
    at C:\Users\Mehroz\AppData\Roaming\npm\node_modules\ionic\node_modules\tslib\tslib.js:107:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\Mehroz\AppData\Roaming\npm\node_modules\ionic\node_modules\tslib\tslib.js:103:16)
    at Object.importAppScripts (C:\Users\Mehroz\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\cli-utils\lib\ionic-angular\app-scripts.js:7:20)

Ionic Info Below

$ ionic info
[ERROR] Error with .\node_modules\ionic-angular\package.json file: FILE_NOT_FOUND
[ERROR] Error with .\node_modules\@ionic\app-scripts\package.json file: FILE_NOT_FOUND

cli packages: (C:\Users\Mehroz\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 6.5.0

local packages:

    @ionic/app-scripts : not installed
    Cordova Platforms  : android 6.2.3 browser 4.1.0
    Ionic Framework    : not installed

System:

    Node : v8.11.2
    npm  : 6.1.0
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro



Thanks in Advance