Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: app-scripts serve unexpectedly failed #2247

Closed
Aaron-Sterling opened this issue May 10, 2017 · 19 comments
Closed

Error: app-scripts serve unexpectedly failed #2247

Aaron-Sterling opened this issue May 10, 2017 · 19 comments
Assignees
Labels
Milestone

Comments

@Aaron-Sterling
Copy link

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.

@tnovau
Copy link

tnovau commented May 10, 2017

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. (C:\Users\tnovau\client\node_modules@ionic\cli-plugin-ionic-angular\dist\serve.js:50:19)
at Generator.next ()
at fulfilled (C:\Users\tnovau\client\node_modules@ionic\cli-plugin-ionic-angular\dist\serve.js:4:58)

@imhoffd
Copy link
Contributor

imhoffd commented May 10, 2017

@Aaron-Sterling @tnovau Does this happen with app-scripts 1.3.6?

@imhoffd imhoffd changed the title had to revert to 2.2.3 because ionic serve kept failing Error: app-scripts serve unexpectedly failed May 10, 2017
@tnovau
Copy link

tnovau commented May 10, 2017

1.3.7 is the version i have.

@imhoffd
Copy link
Contributor

imhoffd commented May 10, 2017

Can you try with 1.3.6?

npm install --save-dev @ionic/app-scripts@1.3.6

@tnovau
Copy link

tnovau commented May 10, 2017

I run npm instal --save-dev @ionic/app-scripts@1.3.6,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. (C:\Users\tnovau\Documents\proyectos\ionic3project\ADX\client\node_modules@ionic\cli-plugin-ionic-angular\dist\serve.js:50:19)
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)

@Aaron-Sterling
Copy link
Author

Aaron-Sterling commented May 10, 2017

@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.

@quentinchap
Copy link

I made the same action than @Aaron-Sterling and on my side i had an error after this installation of angular/animation

@aditya27dev
Copy link

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,

@imhoffd imhoffd added the bug label May 11, 2017
@imhoffd imhoffd added this to the CLI 3.0.1 milestone May 11, 2017
@JulioCesarCeron
Copy link

JulioCesarCeron commented May 15, 2017

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.

@imhoffd imhoffd modified the milestones: CLI Future, CLI 3.1.0 May 15, 2017
@imhoffd
Copy link
Contributor

imhoffd commented May 15, 2017

@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.

@NicolasBehra
Copy link

I have no longer this error in sudo:

sudo ionic serve

@realfreebird
Copy link

Here is a way to reproduce the bug:
https://github.com/realfreebird/reproduce-ionic-cli-bug-2247

steps to reproduce:

  1. add to package.json
"config": {
    "ionic_copy": "./config/copy.config.js"
  },
  1. copy node_modules@ionic\app-scripts\config\copy.config.js to .\config\
  2. edit .\config\copy.config.js, add the following lines
module.exports = {
...
reproduce_ionic_cli_bug_2247: {
    src: ['{{ROOT}}/node_modules/non_exiting_file.txt'],
    dest: '{{BUILD}}'
  }
...
}

@imhoffd
Copy link
Contributor

imhoffd commented May 16, 2017

@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?

@realfreebird
Copy link

@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

@imhoffd
Copy link
Contributor

imhoffd commented May 16, 2017

@realfreebird Okay. Would you mind trying this with the alpha CLI? npm i -g ionic@canary

@paulonbastos
Copy link

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.

@imhoffd
Copy link
Contributor

imhoffd commented May 16, 2017

@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.

@thornch
Copy link

thornch commented May 23, 2017

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.

@giovannipds
Copy link

@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/app-scripts@1.3.6 invalid 'cause of sw-toolbox, tried installing @ionic/app-scripts@1.3.6 and running ionic serve later worked.

--> npm i @ionic/app-scripts@^.1.3.7 --save-dev solves. <--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests