Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic serve Cannot read property 'hasOwnProperty' of undefined (CLI v2.1.7)

New project just installed by ionic (following instructions on ionic's site) on macOs Sierra. When I try to run ionic serve it fails with this error:

TypeError: Cannot read property 'hasOwnProperty' of undefined
    at Object.runr (/usr/local/lib/node_modules/ionic/lib/cli.js:191:19)
    at /usr/local/lib/node_modules/ionic/lib/cli.js:54:9
    at _fulfilled (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:749:13)
    at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:557:44
    at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
    at doNTCallback0 (node.js:419:9)
    at process._tickCallback (node.js:348:13)


Cannot read property 'hasOwnProperty' of undefined (CLI v2.1.7)

Your system information:

Cordova CLI: 5.4.1 
Ionic CLI Version: 2.1.7
Ionic App Lib Version: 2.1.4
ios-deploy version: 1.9.0 
ios-sim version: 5.0.11 
OS: macOS Sierra
Node Version: v4.2.4
Xcode version: Xcode 8.0 Build version 8A218a

I have uninstalled and reinstalled ionic but still getting same error. I was not getting any issues when using OS-X 10.9.

like image 217
meanstacky Avatar asked Nov 10 '16 03:11

meanstacky


3 Answers

Ionic (CLI) 2.1.7 seems to be unstable. Try reinstalling ionic 2.0.0:

 npm uninstall -g ionic

 npm install -g [email protected]
like image 88
mvermand Avatar answered Oct 12 '22 21:10

mvermand


npm uninstall -g ionic

npm install -g [email protected]

2.1.8 FIX IT!

see https://github.com/driftyco/ionic-cli/commit/3fde646

like image 44
Marco Cianci Avatar answered Oct 12 '22 19:10

Marco Cianci


As of ionic version 2.2.X the issue still exists if you try to serve an old app. Solution: create a file package.json with an empty object - { }, and place it in the root folder (by side of the www folder).

like image 25
David D. Avatar answered Oct 12 '22 21:10

David D.