Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package has been ignored because it contains invalid configuration #18844

Closed
droplessjake opened this issue Mar 23, 2022 · 44 comments
Closed

Package has been ignored because it contains invalid configuration #18844

droplessjake opened this issue Mar 23, 2022 · 44 comments

Comments

@droplessjake
Copy link

I'm seeing this error a lot recently across my project. I can't say for sure when it occurred but seems to have been with some recent package updates.

Error is below

warn Package @fortawesome/pro-light-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/runner/work/1/s/node_modules/@fortawesome/pro-light-svg-icons/package.json.js'
warn Package @fortawesome/pro-regular-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/runner/work/1/s/node_modules/@fortawesome/pro-regular-svg-icons/package.json.js'
warn Package @fortawesome/pro-solid-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/runner/work/1/s/node_modules/@fortawesome/pro-solid-svg-icons/package.json.js'

It seems to be hanging a lot of build commands and gets thrown during a lot of react native and yarn commands.

@tagliala
Copy link
Member

@robmadole could you please take a look?

@robmadole
Copy link
Member

@droplessjake can you tell me what tool you are using?

@droplessjake
Copy link
Author

droplessjake commented Mar 23, 2022

@robmadole We're using fontawesome in react native, latest versions of all libraries and a pro license. This error only seems to have appeared recently, possibly when we updated react native to 16.x.

@harryt04
Copy link

I am seeing the same issue with react native. I only installed this package for the first time today though, following this guide. We are pro subscribers who successfully use icons on our angular web app. It seems we can still use icons despite the warning. Just thought I'd add my two cents here since this is a new issue and I couldn't get the warning to go away despite the fact that it seems to be working.

warn Package @fortawesome/free-solid-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/i24740/Documents/git/mobile/node_modules/@fortawesome/free-solid-svg-icons/package.json.js'
warn Package @fortawesome/pro-light-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/i24740/Documents/git/mobile/node_modules/@fortawesome/pro-light-svg-icons/package.json.js'
warn Package @fortawesome/pro-regular-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/i24740/Documents/git/mobile/node_modules/@fortawesome/pro-regular-svg-icons/package.json.js'
warn Package @fortawesome/pro-solid-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/i24740/Documents/git/mobile/node_modules/@fortawesome/pro-solid-svg-icons/package.json.js'

We have a .yarnrc.yml file that looks like the following:

nmHoistingLimits: workspaces

nodeLinker: node-modules
enableStrictSsl: false

npmScopes:
  fortawesome:
    npmAlwaysAuth: true
    npmAuthToken: <NPM-TOKEN>
    npmRegistryServer: "https://npm.fontawesome.com/"

@droplessjake
Copy link
Author

@robmadole @harryt04 Looks like exactly the same issue, whats interesting to me is its looking for package.json.js files, when it should surely be looking for just the package.json files that do exist.

@droplessjordan
Copy link

droplessjordan commented Mar 25, 2022

The solution is in this thread. Downgrade from v6, it doesn't work in production mode causing the build to hang. If you need v6 icons you can use Tree-Shaking https://fontawesome.com/docs/apis/javascript/tree-shaking

@harryt04
Copy link

I downgraded to @^5 for all the pro icons packages because I didn't want to do deep imports. The warnings went away.

@swelly-ian
Copy link

Yep only occurs in v6

@DrOverbuild
Copy link

DrOverbuild commented Jun 9, 2022

react-native-font v0.3.0 was released, with full support for FontAwesome 6. However, the warnings are still showing up.

The warning seems to be related to react-native-community/cli#1168. I think a simple fix would be to add "./package.json": "./package.json" to the exports property in the package.json off every icon npm package, as shown:

  "exports": {
    //...
    "./package.json": "./package.json", // <----
    "./*": "./*.js"
  }

@likon416
Copy link

I still have this error. Can't build v6 using expo for android.

@likon416
Copy link

likon416 commented Jun 29, 2022

Task :app:bundleReleaseJsAndAssets
[stderr]
warn Package @fortawesome/free-brands-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/home/expo/workingdir/build/node_modules/@fortawesome/free-brands-svg-icons/package.json.js'
[stderr]
warn Package @fortawesome/free-regular-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/home/expo/workingdir/build/node_modules/@fortawesome/free-regular-svg-icons/package.json.js'
[stderr]
warn Package @fortawesome/free-solid-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/home/expo/workingdir/build/node_modules/@fortawesome/free-solid-svg-icons/package.json.js'
[stderr]
warn Package @fortawesome/pro-light-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/home/expo/workingdir/build/node_modules/@fortawesome/pro-light-svg-icons/package.json.js'
[stderr]
warn Package @fortawesome/pro-regular-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/home/expo/workingdir/build/node_modules/@fortawesome/pro-regular-svg-icons/package.json.js'
[stderr]
warn Package @fortawesome/pro-solid-svg-icons has been ignored because it contains invalid configuration. Reason: Cannot find module '/home/expo/workingdir/build/node_modules/@fortawesome/pro-solid-svg-icons/package.json.js'
warning: the transform cache was reset.

have react-native-fontawesome 0.3.0 added exports to package.json and nothing works. only for android eas build, iOS build is fine.

@kylesziv
Copy link

Same here

@likon416
Copy link

@robmadole any tips?

@likon416
Copy link

likon416 commented Jul 7, 2022

Anyone?

@robmadole
Copy link
Member

We've got a fix for this that will be released in 6.1.2. No firm ETA on that yet but our aim is in the next 2 - 3 weeks.

@likon416
Copy link

likon416 commented Jul 7, 2022

Great news. Would really appreciate fast release. Thanks

@irmakcosarsahna
Copy link

irmakcosarsahna commented Jul 10, 2022

Same issue

1 similar comment
@mimitch2
Copy link

Same issue

@mimitch2
Copy link

react-native-font v0.3.0 was released, with full support for FontAwesome 6. However, the warnings are still showing up.

The warning seems to be related to react-native-community/cli#1168. I think a simple fix would be to add "./package.json": "./package.json" to the exports property in the package.json off every icon npm package, as shown:

  "exports": {
    //...
    "./package.json": "./package.json", // <----
    "./*": "./*.js"
  }

This worked for me as a temp fix until a real fix is availalble.

@likon416
Copy link

@mimitch2 yeah tried that but it doesn't work for me...

@likon416
Copy link

@robmadole how it's going with the fix? any release soon? it really blocks my android build

@robmadole
Copy link
Member

The fix is done, we just haven't released it yet. I'm hoping to get to the 6.1.2 release next week.

@loursbourg
Copy link

For some reason, this happens only on macOS. It works fine on Windows.

@loursbourg
Copy link

loursbourg commented Jul 19, 2022

@likon416
For now, downgrade to the following versions as a workaround until the proper fix gets merged. (may vary depending on whether you have the pro/free version)

"@fortawesome/fontawesome-svg-core": "1.2.36",
"@fortawesome/free-brands-svg-icons": "5.15.4",
"@fortawesome/free-regular-svg-icons": "5.15.4",
"@fortawesome/free-solid-svg-icons": "5.15.4",
"@fortawesome/react-native-fontawesome": "0.2.7",

@likon416
Copy link

@loursbourg I don't want to do it as the naming of icons is different in v5. Would need to change them all.

@mimitch2
Copy link

mimitch2 commented Jul 19, 2022

@mimitch2 yeah tried that but it doesn't work for me...

To be clear, this is only working for me in dev/local mode, and each time I run yarn install, I need to add this line back in. I'm not at the point where I am building it for real, in which case I'm sure this would not work.

@harbolaez
Copy link

Any eta, when could the fix go out live @robmadole ? Thanks!

@likon416
Copy link

I'm waiting for this as well as it blocks my Android release. If everything is ready why you guys will just not release it? come on :)

@likon416
Copy link

After the update, my build pass the point when it was hanging, but still, all takes more than 45 min to build and expo is cancelling the build as it exceeds the time limit. Normally the build is 15 min, so I think there is still some problem. Do others have the same? Can you guys now do build for android using expo eas build?

@Arjan-Zuidema
Copy link

@likon416 Are you using explicit imports? That could also be the problem of your slow build when not used correctly.

@likon416
Copy link

@Arjan-Zuidema no, I'm using normal strings

@DrOverbuild
Copy link

Yeah @likon416 from my testing it seems these warnings are unrelated to the long release build times, which are actually related to the bundler's tree shaking process.

Since you are using normal strings, I'd check where you're building your library, and make sure that the imports are deep imports there.

@likon416
Copy link

@DrOverbuild thanks I will try that. I'm building using expo and it's not showing what is the error or on what it has stuck.

@robmadole
Copy link
Member

All, we've released 6.1.2 which includes a fix for this. Please let me know after you upgrade if that fixes things up.

@DrOverbuild
Copy link

Hi @robmadole, the warnings are resolved, at least in our project. Thank you for getting the release out and letting us know about the fix!

@mimitch2
Copy link

Working great for me.

@likon416
Copy link

@robmadole the projects are past the point where it hung before although the build is super long, I don't really know if that's fonts problem or not yet.

@robmadole
Copy link
Member

@likon416 can you take a look and make sure you are importing icons like we describe here. We call them "deep imports"?

https://fontawesome.com/v6/docs/web/use-with/react-native#same-icon-different-styles

@likon416
Copy link

@robmadole thanks for getting back to me. I'm not importing it icon by icon, I think it's not dynamic and specifying every single icon is a bit too much.
I'm doing general library.add(far, fas);

But I can try to specify single icons I'm using and try it that will help, but in the end that shouldn't be a solution.
I will try that and let you know.
Hard to read from android build logs what causes the build to go from 15m to over 45m.

@ccorneliusHsv
Copy link

@robmadole I believe I am importing all icons with deep imports..but I am getting some crazy long build times on Github Actions builds with updating to the latest. Over an hour for Android and over 3 hours for iOS. All of my imports are below as well as the packages I am using. Am I missing something??

"@fortawesome/fontawesome-svg-core": "^6.1.2",
"@fortawesome/free-brands-svg-icons": "^6.1.2",
"@fortawesome/pro-light-svg-icons": "^6.1.2",
"@fortawesome/pro-regular-svg-icons": "^6.1.2",
"@fortawesome/pro-solid-svg-icons": "^6.1.2",
"@fortawesome/react-native-fontawesome": "^0.3.0",

import { FontAwesomeIcon, FontAwesomeIconStyle } from "@fortawesome/react-native-fontawesome";
import { IconPrefix, IconProp, Transform } from "@fortawesome/fontawesome-svg-core";
import { IconName } from "@fortawesome/free-brands-svg-icons";
import { library } from "@fortawesome/fontawesome-svg-core";
import { faStar } from "@fortawesome/pro-regular-svg-icons/faStar";
import { faSquareCheck } from "@fortawesome/pro-regular-svg-icons/faSquareCheck";
import { faBookmark } from "@fortawesome/pro-regular-svg-icons/faBookmark";
import { faBookmark as faBookMarkSolid } from "@fortawesome/pro-solid-svg-icons/faBookmark";
import { faCheck } from "@fortawesome/pro-regular-svg-icons/faCheck";
import { faCheck as faCheckSolid } from "@fortawesome/pro-solid-svg-icons/faCheck";
import { faCheck as faCheckLight } from "@fortawesome/pro-light-svg-icons/faCheck";
import { faCircleUser } from "@fortawesome/pro-regular-svg-icons/faCircleUser";
import { faEllipsisV } from "@fortawesome/pro-regular-svg-icons/faEllipsisV";
import { faShareAlt as faShareAltSolid } from "@fortawesome/pro-solid-svg-icons/faShareAlt";
import { faCircleExclamation } from "@fortawesome/pro-regular-svg-icons/faCircleExclamation";
import { faCircleExclamation as faCircleExclamationSolid } from "@fortawesome/pro-solid-svg-icons/faCircleExclamation";
import { faTimes } from "@fortawesome/pro-regular-svg-icons/faTimes";
import { faSquare } from "@fortawesome/pro-regular-svg-icons/faSquare";
import { faChevronCircleDown as faChevronCircleDownSolid } from "@fortawesome/pro-solid-svg-icons/faChevronCircleDown";
import { faExchange } from "@fortawesome/pro-regular-svg-icons/faExchange";
import { faAngleDown } from "@fortawesome/pro-regular-svg-icons/faAngleDown";
import { faChevronRight } from "@fortawesome/pro-regular-svg-icons/faChevronRight";
import { faChevronRight as faChevronRightLight } from "@fortawesome/pro-light-svg-icons/faChevronRight";
import { faChevronDown as faChevronDownSolid } from "@fortawesome/pro-solid-svg-icons/faChevronDown";
import { faChevronLeft } from "@fortawesome/pro-regular-svg-icons/faChevronLeft";
import { faSlidersH } from "@fortawesome/pro-regular-svg-icons/faSlidersH";
import { faInfoCircle } from "@fortawesome/pro-regular-svg-icons/faInfoCircle";
import { faInfoCircle as faInfoCircleLight } from "@fortawesome/pro-light-svg-icons/faInfoCircle";
import { faBars as faBarsLight } from "@fortawesome/pro-light-svg-icons/faBars";
import { faSearch } from "@fortawesome/pro-regular-svg-icons/faSearch";
import { faCircleCheck as faCircleCheckLight } from "@fortawesome/pro-light-svg-icons/faCircleCheck";
import { faCircleCheck as faCircleCheckSolid } from "@fortawesome/pro-solid-svg-icons/faCircleCheck";
import { faTimesCircle as faTimesCircleLight } from "@fortawesome/pro-light-svg-icons/faTimesCircle";
import { faTimesCircle as faTimesCircleSolid } from "@fortawesome/pro-solid-svg-icons/faTimesCircle";
import { faArrowUp } from "@fortawesome/pro-regular-svg-icons/faArrowUp";
import { faArrowLeft } from "@fortawesome/pro-regular-svg-icons/faArrowLeft";
import { faTags } from "@fortawesome/pro-regular-svg-icons/faTags";
import { faEyeSlash as faEyeSlashSolid } from "@fortawesome/pro-solid-svg-icons/faEyeSlash";
import { faEye as faEyeSolid } from "@fortawesome/pro-solid-svg-icons/faEye";
import { faList as faListSolid } from "@fortawesome/pro-solid-svg-icons/faList";
import { faEnvelope } from "@fortawesome/pro-regular-svg-icons/faEnvelope";
import { faEnvelope as faEnvelopeSolid } from "@fortawesome/pro-solid-svg-icons/faEnvelope";
import { faMobileAlt as faMobileAltSolid } from "@fortawesome/pro-solid-svg-icons/faMobileAlt";
import { faPlusSquare as faPlusSquareSolid } from "@fortawesome/pro-solid-svg-icons/faPlusSquare";

@robmadole
Copy link
Member

@ccorneliusHsv it might be this:

import { IconName } from "@fortawesome/free-brands-svg-icons";

Try this instead:

import { IconName } from "@fortawesome/fontawesome-svg-core";

@ccorneliusHsv
Copy link

@robmadole That did not fix the issue. Should I start a new issue to capture this? Any other ideas?

@robmadole
Copy link
Member

robmadole commented Aug 17, 2022

@ccorneliusHsv yes, please, let's start a new issue at https://github.com/FortAwesome/react-native-fontawesome. I think we'll have to have a good reproducible test case to continue. I know that can be challenging for a mobile app. Is this something you can help us create?

@ccorneliusHsv
Copy link

@robmadole I have submitted a new issue #19272. Will do what I can to create a reproducible test case..it will be a lower priority as updating this package is not on the critical path. Will update the new issue with info when available. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests