Ionic-cli: I updated to latest version, It didn't work by Error: Cannot find module 'reflect-metadata'

Created on 27 Dec 2016  路  8Comments  路  Source: ionic-team/ionic-cli

_From @KirsiYin on December 23, 2016 3:26_

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

this is my info

Your system information:

ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.48
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed

after run ionic serve, it shown error like that

ionic-conference-app@ ionic:serve C:\Users\Hoang Xuan Thanh\Downloads\ionic\ionic-conference-app-master\ionic-conference-app-master
ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"

keywords if/then/else require v5 option
module.js:471
throw err;
^

Error: Cannot find module 'reflect-metadata'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\Hoang Xuan Thanh\Downloads\ionic\ionic-conference-app-master\ionic-conference-app-master\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\Hoang Xuan Thanh\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "ionic:serve" "--" "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! node v6.9.2
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! ionic-conference-app@ ionic:serve: ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-conference-app@ ionic:serve script 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--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-conference-app 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" "0.0.0.0" "--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-conference-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ionic-conference-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Hoang Xuan Thanh\Downloads\ionic\ionic-conference-app-master\ionic-conference-app-master\npm-debug.log
There was an error serving your Ionic application: There was an error with the spawned command: serve

_Copied from original issue: driftyco/ionic#9770_

All 8 comments

_From @graphefruit on December 23, 2016 11:35_

@KirsiYin Have you tried to install a starter app, is it working there?

-> ionic start myProject --v2

Hello guys am having exactly the same problem,whats the solution please.

Same problem here - even all the way up to node 7.4.0 now as well. Also completely reinstalled ionic to boot.

ionic serve doesnt work

Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
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: v6.9.4
Xcode version: Not installed

Module.js:471
throw err;
^

Error: Cannot find module 'reflect-metadata'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\ebart\Documents\GitHub\bodrumcloudloginangularfire\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

if you remove node_modules folder and install again ionic with g "npm install -g ionic cordova"

Same problem, any solution to this?

Found a fix for it:

  • Open your project folder
  • Open Package.json and add "reflect-metadata": "^0.1.3",
  • run npm install on the folder

--> ionic is no longer adding reflect-metadata to the package.json

i find this solution it works:
in the Ionic Project, open:

package.json
Add this in it:

"reflect-metadata": "^0.1.3",
Then run this on console: npm install

and Then run this: 'npm rebuild or 'npm rebuild node-sass''

Ready to run ionic serve to see your app ;)

For Info
I had this problem but only by installing new apps package from ionic's github (whatever the template).

For another reason i've updated node for Node Version: v6.10.2.
Since I don't have anymore this pb.

Was this page helpful?
0 / 5 - 0 ratings