ionic-framework: bug: Ionic/vue ionicons error
Bug Report
Ionic version:
[x] 4.x @ionic/vue@0.0.4 or @ionic/vue@next
Current behavior:
When updating vue apps developed with Ionic/vue@0.0.4 and running the
npm install
after having deleted the node_modules folder, i got the following error
Uncaught TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at addIcons (chunk-ea2b3dce.js?d602:13)
at appInitialize (ionic-vue.esm.js?481b:279)
at Object.install (ionic-vue.esm.js?481b:687)
at Function.Vue.use (vue.runtime.esm.js?2b0e:5101)
at eval (main.js?56d7:12)
at Module../src/main.js (app.js:10193)
at __webpack_require__ (app.js:767)
at fn (app.js:130)
at Object.1 (app.js:10267)
Expected behavior:
Should be able to load ionicons. this was working perfect when @ionic/core@4.4.0 and ionicons@4.5.6 were dependencies. Now when you reinstall from scratch the dependencies are @ionic/core@4.6.0 and ionicons@4.5.10-2 and it is failing both for @ionic/vue@0.0.4 and @ionic/vue@next
Steps to reproduce:
- take an existing vue apps running with @ionic/core@4.4.0 and ionicons 4.5.6
- delete the folder node_modules
- delete the package-lock.json
- npm install
Related code: look at
https://github.com/jepiqueau/vue-test-stencil-svgpaths-morphing
which fails look at
https://github.com/jepiqueau/vue-test-stencil-colorpicker
which works
insert short code snippets here
Other information:
Ionic info:
Ionic:
Ionic CLI : 5.0.2
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v10.15.3
npm : 6.9.0
OS : macOS Mojave
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 16
- Comments: 46
Just add
ionicons@4.5.9-1to your package.json. This just overrides any peer dependency and can be used as a workaround.It is published on npm do npm install --save @ionic/vue@next
I’m seeing the same issue. It is probably related to the warning that appears when running
ionic serve:Temporarily,
I did this, and app worked for me but that’s not the right solution, but you can do this now to can continue your work
if you can’t find these file go to project directory and from computer/lap search right the first name of file. (if you search for ionic-vue.esm.js write -> ionic and will appear all files/folders started with ionic then choose the file you’re looking for in this case (you should choose ionic-vue.esm.js ).
Just install the ionic package:
npm install ionicons@4.5.9-1 --save-devas @yasin-mesut suggestedSame here. Cant serve freshly created app.
Abdlrahmansaber’s temp-fix works, (He means “Comment” not “Common”) You want to comment out the lines he commented out in his screenshots.
For people running into this in the future, the fix is somewhat buried above. Just update your version of @ionic/vue, eg:
the work around i found is to first install
modify the main.js file
and keep the file router.js as it is meaning still using the IonicVueRouter
and it works fine. Now if you look at package-lock.json ,
probably I know the reason of this bug
the reason because if you trying to import the {ICON_PATH} it’s return nothing, try to print it in console it will return nothing.
I’m facing the same issue. Cant serve freshly created app.
In fact to see the icons the main.js should be :
Now the icons are displayed This can be use as workaround till @ionic/vue is updated to @ionic/core@one
the solution for having other icons is to add them in the main.js file ie for icons “star”,“trash”,“create” you do this
that’s it and it works so do it for any icons you want to use even for the one you want to add in a ion-item hope it’s help
I get this resolved by changing ionicons version in package-lock.json
But it should be work with fresh npm install in fact
@wannymiarelli I know it’s killed the icon but you can develop whole app without icon until fix the bug
and you’re right it’s not solution for released app
Have a look at branch
ioniconeofhttps://github.com/jepiqueau/vue-test-stencil-svgpaths-morphingi add a TestIcons button in Home.Vue and a TestIcons.Vue showing the desired iconsIt works fine in @ionic/vue@0.0.9 but only with the ions added in vue appInitialize, ie: close, reorder, menu, arrow-forward, arrow-back, arrow-down, search & close-circle.
When can we hope to have the full access to all icons?
Yes, I applied the solution of @daarioautumn just downgrade the ionicons package to 4.5.8
You should use the one I suggested two days ago it works and you see the icons
edit: It works fine to me, even with your quoted import
I’ve applied the solution of @Abdlrahmansaber. But it’s not working properly (the compile warning and console error disapeared). I’m trying to follow that: https://ionicframework.com/blog/announcing-the-ionic-vue-beta/ But in the moment I add
to main.js all I get is a “blank” page.
Current dependencies versions: “dependencies”: { “@ionic/vue”: “0.0.4”, “vue”: “^2.6.10”, “vue-router”: “^3.0.3” }, “devDependencies”: { “@vue/cli-service”: “^3.8.0”, “vue-template-compiler”: “^2.6.10” }
Thank you Adrianmed 😃
Same here