ionic-framework: When I update to latest version, It didn't work by Error: Cannot find module 'reflect-metadata'
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/
After I update ionic CLI to version 2.1.17 and create a new project by command:
ionic start projectxxx --v2 tabs
Then I try:
cd projectxxx ionic serve
Then it throw an exception:
C:\Users\Administrator\Documents\ionic\ionv2>ionic serve
> ionic-app-base@ ionic:serve C:\Users\Administrator\Documents\ionic\ionv2
> ionic-app-scripts serve
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.<anonymous> (C:\Users\Administrator\Documents\ionic\ionv2\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4: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! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:serve" "--"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! ionic-app-base@ ionic:serve: \`ionic-app-scripts serve\`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-app-base@ ionic:serve script 'ionic-app-scripts serve'.
npm ERR! This is most likely a problem with the ionic-app-base package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-app-base
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls ionic-app-base
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Administrator\Documents\ionic\ionv2\npm-debug.log
There was an error serving your Ionic application: There was an error with the spawned command: serve
Then I try start a project by ionic v1,It works!
So,how to fix it in ionic v2.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15
into your project folder run in terminal npm install reflect-metadata then run ionic serve
😉
cd
into your project folder Typenpm install reflect-metadata
Now run
ionic serve
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
OS
Ubuntu 16.04
Install reflect-metadata and angular-cli
sudo npm install -g reflect-metadata
sudo npm install -g angular-cli
ionic serve
use nodejs 4.8.0 , si tiene problema con version de nodejs, usa NVM
After I update my node to version 6.9.1
It Worked
Thank You graphefruit
Oh and I see now, upgrade to node.js 6.9 you’re using 4.3! - it was pointed out some way earlier you need the latest node.js