TypeError: cannot read property 'toString' of undefined with ionic serve

hey Guys, please i need help here. every thing was working fine until this error:

application/gradify/node_modules/@ionic/app-scripts/dist/dev-server      /live-reload.js:27
var contentStr = content.toString();

TypeError: Cannot read property 'toString' of undefined
at Object.injectLiveReloadScript (/media/volodymyr/Media/[[1]] work/[8]programming/[1]keenethics/traineeProgram/probaionic/node_modules/@ionic/app-scripts/dist/dev-server/live-reload.js:27:29)
at ReadFileContext.callback (/media/volodymyr/Media/[[1]] work/[8]programming/[1]keenethics/traineeProgram/probaionic/node_modules/@ionic/app-scripts/dist/dev-server/http-server.js:62:39)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)

npm ERR! Linux 4.4.0-57-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "ionic:serve" "--" "--v2" "--address" "" "--port" "8100" "--livereload-port" "35729"
npm ERR! node v6.9.5
npm ERR! npm  v4.1.2
npm ERR! ionic-hello-world@ ionic:serve: `ionic-app-scripts serve "--v2" "--address" "" "--port" "8100" "--livereload-port" "35729"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ionic-hello-world@ ionic:serve script 'ionic-app-scripts serve "--v2" "--address" "" "--port" "8100" "--livereload-port" "35729"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts serve "--v2" "--address" "" "--port" "8100" "--livereload-port" "35729"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above

system info:
cordova cli: 6.5.0
ionic framework version:2.2.0
ionic cli: 2.2.2
ionic App Lib version: 2.2.1
ionic App Script version: 1.1.4
OS: window 7
node version: v6.9.5

my package.json file

  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  "dependencies": {
    "@angular/common": "2.4.8",
    "@angular/compiler": "2.4.8",
    "@angular/compiler-cli": "2.4.8",
    "@angular/core": "2.4.8",
    "@angular/forms": "2.4.8",
    "@angular/http": "2.4.8",
    "@angular/platform-browser": "2.4.8",
    "@angular/platform-browser-dynamic": "2.4.8",
    "@angular/platform-server": "2.4.8",
    "@ionic/cloud-angular": "^0.11.0",
    "@ionic/storage": "^2.0.1",
    "angular2-jwt": "^0.2.0",
    "cors": "^2.8.1",
    "ionic-angular": "2.2.0",
    "ionic-native": "2.4.1",
    "ionic2-rating": "^1.2.0",
    "ionicons": "3.0.0",
    "provide": "^0.1.3",
    "rxjs": "5.0.1",
    "sw-toolbox": "3.4.0",
    "typing": "^0.1.9",
    "zone.js": "0.7.2"
  "devDependencies": {
    "@ionic/app-scripts": "1.1.4",
    "typescript": "2.0.9"
  "cordovaPlugins": [
  "cordovaPlatforms": [],
  "description": "gradify: An Ionic project"

I have searched all over the net for solution but to no avail, even the ones that suggested i edit live-reload.ts and http-server.js, didn’t solve the issue.

please any help will be appreciated. i have gone through my code to check whether anything is broken but none that i can see.

1 Like

I just got the same issue, tried many things, and finally got “ionic serve” to work just by installing the starter project on another drive. Not sure why, permissions or path maybe…

who is content ? it’s simple question…

that is what i ended up doing

You should try running cordova telemetry on
Don’t know why this works but it worked for me…

Your index.html file must have been deleted or damaged. try getting the starter project and copy the index.html file into your project

Finally, I found it.
Shoud be change “ionic.config.json” not to use v2

“name”: “app-ionic2”,
“app_id”: “”,
“v2”: true,
“typescript”: true


“name”: “app-ionic3”,
“integrations”: {
“cordova”: {}
“type”: “ionic-angular”