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

Confusing syntax error message when pointing to a package that does not exist #513

Open
EdmundsEcho opened this issue Feb 22, 2024 · 0 comments

Comments

@EdmundsEcho
Copy link

EdmundsEcho commented Feb 22, 2024

Thank you for this patch utility.

I'm using the latest (as of today), versions of the patch packages.

    "patch-package": "^8.0.0",
    "postinstall-postinstall": "^2.1.0",

Other versions:
node: 18.10.0
yarn: 1.22.21

When I go to create the patch using npx patch-package <mistaken-reference-to-non-existing-package> I get the following syntax error:

   ... /node_modules/fs-extra/lib/mkdirs/make-dir.js:85
      } catch {
              ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (.../node_modules/fs-extra/lib/mkdirs/index.js:3:44)

The patch-package dependency that is causing the error:

    "fs-extra": "^9.0.0",

So, to be clear the operation works as expected when the package name is correct. However, if I make a mistake on the name of the package to be patched, it gives this error that suggests something else is wrong.

I hope this helps the next person interpret this error :))

@EdmundsEcho EdmundsEcho changed the title Error creating a patch in a CRA - dependency on fs-extra Confusing syntax error message when pointing to a package that does not exist Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant