Skip to main content

When executing the following command, the response I'm getting is

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@fortawesome%2fpro-light-svg-icons - Not found
npm ERR! 404
npm ERR! 404  '@fortawesome/pro-light-svg-icons@^5.11.2' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

This error 404 Not Found - GET https://registry.npmjs.org/@fortawesome%2fpro-light-svg-icons - Not found, indicates that the NPM registry cannot find the @fortawesome/pro-light-svg-icons package. This is likely happening due to:

 

Typo in Package Name

Ensure that the package name in your package.json file is correct. Typos or incorrect package names can lead to this error.

 

Private Package or Wrong Scope

If @fortawesome/pro-light-svg-icons is a private package or part of a different scope, you might not have access to it, or it might not be available under the given name in the public npm registry. Font Awesome's Pro icons are indeed part of their paid offerings, which means they are not available in the public npm registry.

 

Access Rights

For accessing Font Awesome Pro packages, you need to authenticate with npm to prove your subscription. Make sure you have access rights to the Font Awesome Pro package. You would typically need to log in to npm with the command npm login and use the credentials associated with an account that has access to the Font Awesome Pro packages.

 

Font Awesome NPM Registry Configuration

Font Awesome Pro packages are hosted in a private npm registry. You need to configure your npm to use the Font Awesome npm registry for @fortawesome scope. You can do this by adding a .npmrc file to your project or home directory.  Your .npmrc file, which npm will use to manage configuration settings.

Here's how to properly set up your project to use Font Awesome Pro icons by configuring the npm registry:

Creating or Modifying .npmrc File

The .npmrc file can be located in your project directory (for project-specific configuration) or in your home directory (for global configuration).
You need to add the registry configuration and your authentication token to this file, not run it as a command in the terminal.

Steps to Configure

  • Open your terminal or command prompt.
  • Navigate to your project directory if you want to configure it specifically for one project, or stay in your home directory for global configuration.
    Open or create the .npmrc file in your editor. If you're in the terminal, you can use a command like nano .npmrc or vim .npmrc to edit or create this file.
  • Add the following lines to the .npmrc file:
@fortawesome:registry=https://npm.fontawesome.com/

And you also need to include your Font Awesome npm token in the .npmrc file:

//npm.fontawesome.com/:_authToken=YOUR_FONTAWESOME_NPM_TOKEN
  • Replace YOUR_FONTAWESOME_NPM_TOKEN with the actual token you received from Font Awesome. This token authenticates you to Font Awesome's npm registry and proves you have access to the Pro icons.
  • Save the .npmrc file and exit the editor.

Verify Configuration

After you've added these lines to your .npmrc file, npm will know to use the Font Awesome npm registry whenever you try to install packages scoped under @fortawesome. You shouldn't get the "no such file or directory" error anymore because you're not trying to run the configuration as a shell command.

Installing Font Awesome Pro Icons

Now that your npm is configured correctly, you can install Font Awesome Pro packages using npm, for example:

npm install @fortawesome/pro-light-svg-icons

This approach tells npm where to find the Font Awesome Pro packages and provides the necessary authentication token for access. Remember, your token should be kept secret and not shared with others

 

Outdated npm Client

In some rare cases, using an outdated version of npm can cause issues. Ensure your npm client is up-to-date by running npm install -g npm.
To resolve this error:

  • Verify your package name and version
  • Ensure you have a valid subscription for Font Awesome Pro if you are trying to access a pro package
  • Configure npm for accessing the Font Awesome Pro registry if necessary
  • Check your .npmrc file for correct setup

Related articles

Andrew Fletcher08 Aug 2022
How to update package.json dependencies to the latest version?
This article works through the steps to update dependencies in package.json file to the latest version. Use npm-check-updates or npm outdated to suggest the latest versions. npm-check-updates is a utility that automatically adjusts a package.json with the latest version of all...