Cross-posting an issue I put on app-scripts yesterday in case you guys are a different team.
ionic-app-scripts issue #975
Problem arose on both existing and new projects. I'm using nvm-for-windows, in case that has any effect. package,json, tsconfig.json and ionic info are at the crosspost. Ionic serve would bring up the homepage of the app, then crash, with this error:
[DEBUG] !!! ERROR ENCOUNTERED !!!
Error: app-scripts serve unexpectedly failed.
[DEBUG] Error: app-scripts serve unexpectedly failed.
at Object. (C:\Users\Aaron\IonicDevelop\ActionSearch\node_modules@ionic\cli-plugin-ionic-angular\dist\serve.js:50:19)
at Generator.next ()
at fulfilled (C:\Users\Aaron\IonicDevelop\ActionSearch\node_modules@ionic\cli-plugin-ionic-angular\dist\serve.js:4:58)
Thanks very much.
I had the same issue, please i need a solution.
ionic info
global packages:
@ionic/cli-utils : 1.0.0
Cordova CLI : 7.0.0
Ionic CLI : 3.0.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.0.0
Ionic Framework : ionic-angular 3.2.0
System:
Node : v7.10.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
Error: app-scripts serve unexpectedly failed.
[DEBUG] !!! ERROR ENCOUNTERED !!!
Error: app-scripts serve unexpectedly failed.
[DEBUG] Error: app-scripts serve unexpectedly failed.
at Object.
at Generator.next (
at fulfilled (C:\Users\tnovau\client\node_modules\@ionic\cli-plugin-ionic-angular\dist\serve.js:4:58)
@Aaron-Sterling @tnovau Does this happen with app-scripts 1.3.6?
1.3.7 is the version i have.
Can you try with 1.3.6?
npm install --save-dev @ionic/[email protected]
I run npm instal --save-dev @ionic/[email protected],and then when i run ionic serve, I get this message after [15:29:50] dev server running: http://localhost:8100/:
[DEBUG] !!! ERROR ENCOUNTERED !!!
Error: app-scripts serve unexpectedly failed.
[DEBUG] Error: app-scripts serve unexpectedly failed.
at Object.
at Generator.next (
at fulfilled (C:\Users\tnovau\Documents\proyectos\ionic3project\ADX\client\node_modules\@ionic\cli-plugin-ionic-angular\dist\serve.js:4:58)
@dwieeb I created a new project (blank), put in my source code folder from my main project, and started adding libraries until I encountered the error. I hit the error at the same point with both 1.3.6 and 1.3.7. Libraries in order of addition were:
npm install @angular/animations
npm install @ngrx/core @ngrx/store --save
ionic cordova plugin add cordova-plugin-inappbrowser@latest
npm install --save @ionic-native/in-app-browser
ionic cordova plugin add call-number
npm install --save @ionic-native/call-number
npm install angularfire2 firebase --save
npm install immutable --save
After installing immutable, I got the error. Up until that point, I had run ionic serve after every install, and it was fine, in both 1.3.6 and 1.3.7.
I made the same action than @Aaron-Sterling and on my side i had an error after this installation of angular/animation
I had this issue when i executed command: ionic cordova run android --livereload -c -s. If you are doing the same, just try to run ionic cordova run platform.
I hope this will solve your issue,
I had the same error message
Error: app-scripts serve unexpectedly failed.
when i executed ionic serve
so i tried to run npm install -g ionic, and the problem is solved.
@Aaron-Sterling @tnovau @JulioCesarCeron I still haven't been able to reproduce this, but I am launching the next version of the CLI with the debugging information you can see in the commit above ^
Hopefully this will shed some light on this issue.
I have no longer this error in sudo:
sudo ionic serve
Here is a way to reproduce the bug:
https://github.com/realfreebird/reproduce-ionic-cli-bug-2247
steps to reproduce:
"config": {
"ionic_copy": "./config/copy.config.js"
},
module.exports = {
...
reproduce_ionic_cli_bug_2247: {
src: ['{{ROOT}}/node_modules/non_exiting_file.txt'],
dest: '{{BUILD}}'
}
...
}
@realfreebird Thanks for being a champ and making that repo 馃憤 Unfortunately I'm still unable to reproduce. Are you on Windows as well? Does an error occur if you try npm run ionic:serve in that repo?
@dwieeb I get this error with ionic serve.
npm run ionic:serve works fine.
Here is my configuration:
ionic info
global packages:
@ionic/cli-utils : 1.0.0
Cordova CLI : 7.0.1
Ionic CLI : 3.0.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.0.0
Ionic Framework : ionic-angular 3.2.1
System:
Node : v6.10.1
OS : Windows 7
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
@realfreebird Okay. Would you mind trying this with the alpha CLI? npm i -g ionic@canary
Worked around this problem by adding an empty file to src/service-worker.js.
it seems that _(the below code is started from line 53 of @ionic\app-scripts\dist\serve.js)_ in the function serve is not return the object config when a non fatal error occurs, such as not find a file in the watch list.
`
.then(function () {
bonjour_1.createBonjourService(config);
onReady(config, context); // <---- Note1 : Returning the config object
return config;
}, function (err) {
throw err;
})
.catch(function (err) {
if (err && err.isFatal) {
throw err;
}
else {
onReady(config, context);
// Note 2 <---- Not returning the config as in note 1
}
});
`
I hacked the server.js to write to the console (sorry still learning the in and outs of this platform, possible a better way to do this.)
`
P:\nau21\ws1\git\fp-app>ionic serve
Starting app-scripts server: --port 8100 --livereload-port 35729 --address 0.0.0.0 - Ctrl+C to cancel
[19:26:30] watch started ...
.....
[19:26:48] lint finished in 605 ms
errError: A watch configured to watch the following paths failed to start. It likely that a file referenced does not exist: P:\nau21\ws1\git\fp-app\src\assets**, P:\nau21\ws1\git\fp-app\src\index.ht
ml, P:\nau21\ws1\git\fp-app\src\manifest.json, P:\nau21\ws1\git\fp-app\src\service-worker.js, P:\nau21\ws1\git\fp-app\node_modules\ionicons\dist\fonts**, P:\nau21\ws1\git\fp-app\node_modules\ionic-angular\fonts***, P:\nau21\ws1\git\fp-app\node_modules\ionic-angular\polyfills\polyfills.js,P:\nau21\ws1\git\fp-app\node_modules\sw-toolbox\sw-toolbox.js
[19:26:51] dev server running: http://localhost:8100/
`
For my ionic info
global packages:
@ionic/cli-utils : 1.0.0
Cordova CLI : 7.0.1
Ionic CLI : 3.0.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.0.0
Ionic Framework : ionic-angular 3.2.0
System:
Node : v6.10.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
Hope this helps.
@paulonbastos I think that's the exact problem. We'll see if it's still an issue when the next version of app-scripts is released. Thanks for diving deep, very helpful.
Possible solution: npm install --save sw-toolbox
The plugin @ ionic/cli-plugin-ionic-angular @ 1.0.0-rc.2 requires @ ionic/app-scripts
Console-Message: npm WARN @ ionic/app-scripts @ 1.3.7 requires a peer of sw-toolbox @ * but none was i
nstalled.
I've got the same problem for "ionic serve" - after installing the missing package it works as expected.
@thornch sw-toolbox didn't solve to me.
@dwieeb neither did ionic@canary.
npm run ionic:serve runs ok.
ionic info:
global packages:
@ionic/cli-utils : 1.4.0
Ionic CLI : 3.4.0
local packages:
@ionic/app-scripts : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Ionic Framework : ionic-angular 2.0.0
System:
Node : v6.11.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10
Tried npm update and didn't solve as well.
After seeing some UNMET PEER DEPENDENCY @ionic/[email protected] invalid 'cause of sw-toolbox, tried installing @ionic/[email protected] and running ionic serve later worked.
--> npm i @ionic/app-scripts@^.1.3.7 --save-dev solves. <--
Most helpful comment
Worked around this problem by adding an empty file to src/service-worker.js.
it seems that _(the below code is started from line 53 of @ionic\app-scripts\dist\serve.js)_ in the function serve is not return the object config when a non fatal error occurs, such as not find a file in the watch list.
`
.then(function () {
`
I hacked the server.js to write to the console (sorry still learning the in and outs of this platform, possible a better way to do this.)
`
P:\nau21\ws1\git\fp-app>ionic serve
Starting app-scripts server: --port 8100 --livereload-port 35729 --address 0.0.0.0 - Ctrl+C to cancel
[19:26:30] watch started ...
.....
[19:26:48] lint finished in 605 ms
errError: A watch configured to watch the following paths failed to start. It likely that a file referenced does not exist: P:\nau21\ws1\git\fp-app\src\assets**, P:\nau21\ws1\git\fp-app\src\index.ht
ml, P:\nau21\ws1\git\fp-app\src\manifest.json, P:\nau21\ws1\git\fp-app\src\service-worker.js, P:\nau21\ws1\git\fp-app\node_modules\ionicons\dist\fonts**, P:\nau21\ws1\git\fp-app\node_modules\ionic-angular\fonts***, P:\nau21\ws1\git\fp-app\node_modules\ionic-angular\polyfills\polyfills.js,P:\nau21\ws1\git\fp-app\node_modules\sw-toolbox\sw-toolbox.js
[19:26:51] dev server running: http://localhost:8100/
`
For my ionic info
global packages:
local packages:
System:
Hope this helps.