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

fix(output): show useful message when a dependency type is not found #234

Open
guillempuche opened this issue Jul 16, 2024 · 2 comments
Open

Comments

@guillempuche
Copy link

Description

I run syncpack list on my Yarn monorepo. There's something is not good on my package.json or Syncpack.

Logs

node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

TypeError: Cannot read properties of undefined (reading 'read')
    at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-package-json-files/package-json-file.js:20:81
    at Array.map (<anonymous>)
    at PackageJsonFile.getInstances (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-package-json-files/package-json-file.js:20:49)
    at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-instances/index.js:9:305
    at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1303:243
    at body (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/core.js:444:17)
    at FiberRuntime.While (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1021:14)
    at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1068:31
    at Object.context (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/tracer.js:73:17)
    at FiberRuntime.runLoop (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1063:28) {
  name: '(FiberFailure) TypeError',
  [Symbol(effect/Runtime/FiberFailure)]: Symbol(effect/Runtime/FiberFailure),
  [Symbol(effect/Runtime/FiberFailure/Cause)]: {
    _tag: 'Die',
    defect: TypeError: Cannot read properties of undefined (reading 'read')
        at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-package-json-files/package-json-file.js:20:81
        at Array.map (<anonymous>)
        at PackageJsonFile.getInstances (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-package-json-files/package-json-file.js:20:49)
        at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-instances/index.js:9:305
        at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1303:243
        at body (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/core.js:444:17)
        at FiberRuntime.While (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1021:14)
        at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1068:31
        at Object.context (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/tracer.js:73:17)
        at FiberRuntime.runLoop (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1063:28)
  }
}

Suggested Solution

Point where is the error.

Help Needed

I add you, @JamieMason, to my private monorepo to check it.

@JamieMason
Copy link
Owner

hey @guillempuchem, it's a small typo of peers -> peer

/** @type {import("syncpack").RcFile} */
export default {
-	dependencyTypes: ['dev', 'prod', 'overrides', 'peers', 'resolutions'],
+	dependencyTypes: ['dev', 'prod', 'overrides', 'peer', 'resolutions'],

I'll leave this open for this to be handled properly with a useful message, thanks.

@JamieMason JamieMason changed the title Improve error message Cannot read properties of undefined (reading 'read') fix(output): show useful message when a dependency type is not found Jul 16, 2024
@guillempuche
Copy link
Author

Thanks Jamie!
This will be a good improvement.

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

2 participants