ds300 / ds300/patch-package

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

Open
#513 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.2k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

Thank you for this patch utility.

I'm using the latest (as of today), versions of the patch packages.
```json
"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 `` I get the following syntax error:

```js
... /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. (.../node_modules/fs-extra/lib/mkdirs/index.js:3:44)

```

The `patch-package` dependency that is causing the error:

```json
"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 :))

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.