question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ion-icon do not load icon if pnpm is used

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

If npm is used and ion-icon refer to a ion-icon name the svg icon loads correctly.

In this example a ion-icon is used and the icon is loaded correctly:

<ion-icon name="eye-off-outline"></ion-icon>

image

If pnpm is used and ion-icon refer to a ion-icon name the svg icon does not loads correctly.

image

Expected Behavior

It should work with pnpm the same way as npm.

Steps to Reproduce

Setup an ionic project or use your current project where and ion-icon is used.

Remove node_modules and package-lock.json.

Install dependencies using pnpm.

Run ionic serve.

Code Reproduction URL

No response

Ionic Info

$ ionic info Ionic: Ionic CLI : 6.20.1 (C:\Users\hsantos\AppData\Roaming\nvm\v14.20.0\node_modules@ionic\cli) Ionic Framework : @ionic/angular 6.2.4 @angular-devkit/build-angular : 14.2.1 @angular-devkit/schematics : 14.2.1 @angular/cli : 14.2.1 @ionic/angular-toolkit : 7.0.0

Utility:

cordova-res : not installed globally native-run : not installed globally

System:

NodeJS : v14.20.0 (C:\Program Files\nodejs\node.exe) npm : 6.14.17 OS : Windows 10

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Aug 30, 2022

Thanks! ionicons should be listed as a direct dependency in our starter applications.

Ionicons is required by @ionic/angular and @ionic/core, so it gets installed to the top level node_modules when using npm. For pnpm this causes issues since ionicons is not installed to the top level node_modules.

I merged a fix to resolve this for new starter applications: https://github.com/ionic-team/starters/pull/1731

For existing applications, the fix is to manually add ionicons as a dependency. As noted in https://github.com/ionic-team/ionic-framework/issues/25846#issuecomment-1231108651.

1reaction
maroon1commented, Aug 30, 2022

@eduboxgithub You can explicitly add ionicons as a dependency in package.json. Because ionicons is a “ghost” dependency, so Angular can not find the ionicons in the root of node_modules directory.

pnpm add ionicons
Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: ionicons aren't loaded in react · Issue #18847 - GitHub
Ya, that seems to be a bug, we get the ability to specify a different icon for IonBackButton in the next release. If...
Read more >
Ionicons not showing after npm installation - Stack Overflow
It turns out that I was using the docs for the wrong version of ionicons: v2.0.0 ionicons.com; v3.0.0 ionicframework.com/docs/ionicons. If ...
Read more >
@expo/vector-icons - npm
Built-in support for popular icon fonts and the tooling to create your own Icon components from your font and glyph map.
Read more >
Cant run npm install - ionic-v3
hi everyone im trying to get this ionic theme running but im getting this error while performing npm install Microsoft Windows [Version ...
Read more >
@steeze-ui/svelte-icon - npm Package Health Analysis | Snyk
Learn more about @steeze-ui/svelte-icon: package health score, ... Expect bugs and breaking changes! ... No known security issues.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found