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

Patch ts-pegjs instead of using a post-install script #3724

Closed
busma13 opened this issue Aug 21, 2024 · 1 comment
Closed

Patch ts-pegjs instead of using a post-install script #3724

busma13 opened this issue Aug 21, 2024 · 1 comment

Comments

@busma13
Copy link
Contributor

busma13 commented Aug 21, 2024

When updating xlucene-parser to ESM there was an issue with importing ts-pegjs that required either a patch or a post-install script to modify a few of its import statements. The current post-install fix isn't working in an internal project that uses yarn 3.7.0 with plug'n'play. The specific error: Error: EROFS: read-only filesystem, open '/node_modules/ts-pegjs/dist/tspegjs.mjs'.

It may be possible to modify the permissions of tspegjs.mjs from within the post-install script, but if not we could consider using https://www.npmjs.com/package/patch-package to make patching in yarn 1 easier.

@busma13
Copy link
Contributor Author

busma13 commented Aug 23, 2024

It looks like the EROFS error was because I was importing xlucene-parser from my local branch. Once it was published to npm it imports properly.

EDIT: the issue came back in the next dependency update.

The problem is that yarn PnP creates a read-only virtual file sytem and the post-install script is attempting to write to disk. The issue was resolved by importing ts-pegjs alongside xlucene-parser and then 'unplugging' it from the virtual file system so that it can be modified.

yarn add xlucene-parser
yarn add ts-pegjs
yarn unplug ts-pegjs

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

1 participant