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.

Package has been ignored because it contains invalid configuration.

See original GitHub issue

After updating to latest versions I’ve been getting the following warning on app startup:

warn Package @graphql-codegen/cli has been ignored because it contains invalid configuration. Reason: Cannot find module '/path/to/my/app/node_modules/@graphql-codegen/cli/package.json.js'
warn Package @graphql-codegen/fragment-matcher has been ignored because it contains invalid configuration. Reason: Cannot find module '/path/to/my/app/node_modules/@graphql-codegen/fragment-matcher/package.json.js'
warn Package @graphql-codegen/introspection has been ignored because it contains invalid configuration. Reason: Cannot find module '/path/to/my/app/node_modules/@graphql-codegen/introspection/package.json.js'
warn Package @graphql-codegen/typescript has been ignored because it contains invalid configuration. Reason: Cannot find module '/path/to/my/app/node_modules/@graphql-codegen/typescript/package.json.js'
warn Package @graphql-codegen/typescript-document-nodes has been ignored because it contains invalid configuration. Reason: Cannot find module '/path/to/my/app/node_modules/@graphql-codegen/typescript-document-nodes/package.json.js'
warn Package @graphql-codegen/typescript-graphql-files-modules has been ignored because it contains invalid configuration. Reason: Cannot find module '/path/to/my/app/node_modules/@graphql-codegen/typescript-graphql-files-modules/package.json.js'
warn Package @graphql-codegen/typescript-graphql-request has been ignored because it contains invalid configuration. Reason: Cannot find module '/path/to/my/app/node_modules/@graphql-codegen/typescript-graphql-request/package.json.js'
warn Package @graphql-codegen/typescript-operations has been ignored because it contains invalid configuration. Reason: Cannot find module '/path/to/my/app/node_modules/@graphql-codegen/typescript-operations/package.json.js'

I haven’t changed anything related to GraphQL Codegen. I’m on TypeScript 4.4.2, and here is the relevant part of my DEV dependencies:

"devDependencies": {
	...
    "@graphql-codegen/cli": "2.1.1",
    "@graphql-codegen/fragment-matcher": "3.1.0",
    "@graphql-codegen/introspection": "2.1.0",
    "@graphql-codegen/typescript": "2.1.2",
    "@graphql-codegen/typescript-document-nodes": "2.1.2",
    "@graphql-codegen/typescript-graphql-files-modules": "2.1.0",
    "@graphql-codegen/typescript-graphql-request": "^4.1.2",
    "@graphql-codegen/typescript-operations": "2.1.2",
	...
  }

To Reproduce Have the latest versions of GraphQL codegen for TypeScript in your dev dependencies, run your app, check console.

Expected behavior The warning shouldn’t display.

Environment:

  • OS: macOS 11.3.1
  • @graphql-codegen/...: See above
  • NodeJS: 14.17.2

Additional context This wasn’t the case before updating to latest versions. Note that this is a minor annoyance, not a breaking bug or anything. Everything still work as expected otherwise.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:17
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
bryansumcommented, Nov 21, 2021

@Urigo This issue isn’t a library bug per se, just creating a warning as side effect, so not sure the failing test would apply here.

fwiw I was able to resolve this by adding to each erroring dependencies’ package.json:

diff --git a/node_modules/@graphql-codegen/cli/package.json b/node_modules/@graphql-codegen/cli/package.json
index 837b908..65c7f50 100644
--- a/node_modules/@graphql-codegen/cli/package.json
+++ b/node_modules/@graphql-codegen/cli/package.json
@@ -85,7 +85,8 @@
     "./*": {
       "require": "./*.js",
       "import": "./*.mjs"
-    }
+    },
+    "./package.json": "./package.json"
   },
   "bin": {
     "gql-gen": "bin.js",

Using the excellent https://github.com/ds300/patch-package#readme you can preserve this by then running npx patch-package --exclude 'nothing' @graphql-codegen/cli for each package causing the warning.

That being said the real fix is probably to fix this in this repo directly

4reactions
stelmakhivancommented, Dec 31, 2021

@dotansimha, @canpoyrazoglu I have just tried to install the latest @graphql-codegen/... packages, and it seems, that we should close this issue - cause there are not any warnings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

warn Package undefined has been ignored because it ...
warn Package undefined has been ignored because it contains invalid configuration. Reason: Cannot find module 'undefined/package.json'.
Read more >
Package react-native-webview has been ignored because it ...
Bug description: I am trying to use react-native-webview and following step. But it doesn't work. yarn add react-native-webview cd ios ...
Read more >
Package has been Ignored because it contains Invalid ...
This react native warning will finally leads to build error while trying to run your application. So, how to fix this particular error?...
Read more >
warn package react-native-vector-icons contains invalid ...
warn Package react-native-vector-icons has been ignored because it contains invalid configuration. Reason: "dependency.assets" is not allowed RN version .
Read more >
guys i am getting this error. warn Package react-native-vector ...
guys i am getting this error. warn Package react-native-vector-icons has been ignored because it contains invalid configuration. Reason: " ...
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