Ionic 2 serve not working on Cloud9


#1

i start using ionic 2 on cloud9 (c9.io). After install step finish i’m trying to test my app using ionic serve, but it wont work. It worked on my ionic v1 project. I trying some command option like :

  • ionic serve -p $PORT --nolivereload (result : error)
  • ionic serve -a $IP -p $PORT --nolivereload (result : error)
  • Ionic serve --address $IP --port $PORT --nolivereload (result : still error)

Error: Cannot find module 'reflect-metadata’
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/home/ubuntu/workspace/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:5:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ionic-hello-world@0.0.0 ionic:serve: ionic-app-scripts serve "--v2" "--port" "8080" "--nolivereload" "--address" "0.0.0.0" "--livereload-port" "35729"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@0.0.0 ionic:serve 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! /home/ubuntu/.npm/_logs/2017-04-24T17_46_41_951Z-debug.log
There was an error serving your Ionic application: There was an error with the spawned command: serve

Is there any idea how can i fix this


#2

Run this`

ionic serve -p $PORT -r 8081


#3

I just did…it came out like this


Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:

Please install your Cordova CLI to version >=4.2.0 npm install -g cordova


ionic-hello-world@0.0.0 ionic:serve /home/ubuntu/workspace
ionic-app-scripts serve “–v2” “–port” “8080” “–livereload-port” “8081” “–address” “0.0.0.0”

module.js:327
throw err;
^

Error: Cannot find module 'reflect-metadata’
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/home/ubuntu/workspace/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:5:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ionic-hello-world@0.0.0 ionic:serve: ionic-app-scripts serve "--v2" "--port" "8080" "--livereload-port" "8081" "--address" "0.0.0.0"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@0.0.0 ionic:serve 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! /home/ubuntu/.npm/_logs/2017-04-24T17_50_30_357Z-debug.log
There was an error serving your Ionic application: There was an error with the spawned command: serve