Ionic-cli: Ionic 2(cli 2.2.1)- Ionic serve not working.

Created on 13 Jan 2017  ·  3Comments  ·  Source: ionic-team/ionic-cli

After updating cli to 2.2.1 ionic serve command failed :(.
ionic info

cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v4.6.0
Xcode version: Not installed

npm-debug.log
0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Users\\Swapnil\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'ionic:serve', 1 verbose cli '--', 1 verbose cli '--v2', 1 verbose cli '--address', 1 verbose cli '0.0.0.0', 1 verbose cli '--port', 1 verbose cli '8100', 1 verbose cli '--livereload-port', 1 verbose cli '35729' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'preionic:serve', 'ionic:serve', 'postionic:serve' ] 5 info lifecycle ionic-hello-world@~preionic:serve: ionic-hello-world@ 6 silly lifecycle ionic-hello-world@~preionic:serve: no script for preionic:serve, continuing 7 info lifecycle ionic-hello-world@~ionic:serve: ionic-hello-world@ 8 verbose lifecycle ionic-hello-world@~ionic:serve: unsafe-perm in lifecycle true 9 verbose lifecycle ionic-hello-world@~ionic:serve: PATH: C:\Users\Swapnil\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;c:\ionic2\approach\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\maven\bin;C:\Program Files (x86)\Android\android-sdk\tools;C:\Program Files (x86)\Android\android-sdk\platform-tools;C:\Program Files\OpenSSL\bin;C:\Program Files\Java\jre1.8.0_66\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\nodejs\;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Java\jdk1.8.0_66\bin;C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.2;C:\Python\Python35-32\Scripts;C:\Python\Python35-32;C:\Users\Swapnil\AppData\Local\Microsoft\WindowsApps;C:\Users\Swapnil\AppData\Roaming\npm;C:\Program Files\Git\bin;C:\Users\Swapnil\AppData\Roaming\Composer\vendor\bin 10 verbose lifecycle ionic-hello-world@~ionic:serve: CWD: c:\ionic2\approach 11 silly lifecycle ionic-hello-world@~ionic:serve: Args: [ '/d /s /c', 11 silly lifecycle 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"' ] 12 silly lifecycle ionic-hello-world@~ionic:serve: Returned: code: 1 signal: null 13 info lifecycle ionic-hello-world@~ionic:serve: Failed to exec ionic:serve script 14 verbose stack Error: ionic-hello-world@ ionic:serve:ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" 14 verbose stack Exit status 1 14 verbose stack at EventEmitter.<anonymous> (C:\Users\Swapnil\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16) 14 verbose stack at emitTwo (events.js:87:13) 14 verbose stack at EventEmitter.emit (events.js:172:7) 14 verbose stack at ChildProcess.<anonymous> (C:\Users\Swapnil\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14) 14 verbose stack at emitTwo (events.js:87:13) 14 verbose stack at ChildProcess.emit (events.js:172:7) 14 verbose stack at maybeClose (internal/child_process.js:829:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) 15 verbose pkgid ionic-hello-world@ 16 verbose cwd c:\ionic2\approach 17 error Windows_NT 10.0.14393 18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Swapnil\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:serve" "--" "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" 19 error node v4.6.0 20 error npm v4.0.5 21 error code ELIFECYCLE 22 error ionic-hello-world@ ionic:serve:ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" 22 error Exit status 1 23 error Failed at the ionic-hello-world@ ionic:serve script 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"'. 23 error Make sure you have the latest version of node.js and npm installed. 23 error If you do, this is most likely a problem with the ionic-hello-world package, 23 error not with npm itself. 23 error Tell the author that this fails on your system: 23 error ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" 23 error You can get information on how to open an issue for this project with: 23 error npm bugs ionic-hello-world 23 error Or if that isn't available, you can get their info via: 23 error npm owner ls ionic-hello-world 23 error There is likely additional logging output above. 24 verbose exit [ 1, true ]
image

Most helpful comment

Ok.. It was because of my code, i was using two @component (one for modal) in single .ts and used templateUrl instead of template with modal @component, changed templateUrl to template it start working. Code was

@Component({
  selector: 'page-html',
  templateUrl: 'page.html',
  providers: [SharedProvider, ApproachApi]
})
export class LeadsPage {
  constructor() { }
}
  @Component({
  templateUrl: 'page-modal.html' 
})
export class ModalContentPage {
  constructor( ) {  }

}

All 3 comments

May be due to incompatible node version. Can you update your node version and try again?

@Maziar-Fotouhi Updated node, npm, reinstall ionic@latest. But no luck.

Ok.. It was because of my code, i was using two @component (one for modal) in single .ts and used templateUrl instead of template with modal @component, changed templateUrl to template it start working. Code was

@Component({
  selector: 'page-html',
  templateUrl: 'page.html',
  providers: [SharedProvider, ApproachApi]
})
export class LeadsPage {
  constructor() { }
}
  @Component({
  templateUrl: 'page-modal.html' 
})
export class ModalContentPage {
  constructor( ) {  }

}
Was this page helpful?
0 / 5 - 0 ratings