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

Error installing prettier plugin with pre commands #4015

Open
bdovaz opened this issue Sep 18, 2024 · 12 comments
Open

Error installing prettier plugin with pre commands #4015

bdovaz opened this issue Sep 18, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@bdovaz
Copy link
Collaborator

bdovaz commented Sep 18, 2024

Describe the bug

I have been using this plugin for some time: https://www.npmjs.com/package/prettier-plugin-multiline-arrays?activeTab=readme

The problem I have is that it randomly crashes with the following:

Output log

2024-09-18T14:21:01.4521848Z
2024-09-18T14:21:01.4522093Z """
2024-09-18T14:21:01.4522195Z
2024-09-18T14:21:01.4522540Z The above exception was the direct cause of the following exception:
2024-09-18T14:21:01.4522738Z
2024-09-18T14:21:01.4523037Z Traceback (most recent call last):
2024-09-18T14:21:01.4523416Z File "", line 198, in _run_module_as_main
2024-09-18T14:21:01.4523808Z File "", line 88, in _run_code
2024-09-18T14:21:01.4524180Z File "/megalinter/run.py", line 14, in
2024-09-18T14:21:01.4524504Z linter.run()
2024-09-18T14:21:01.4524842Z File "/megalinter/MegaLinter.py", line 243, in run
2024-09-18T14:21:01.4525266Z self.process_linters_parallel(active_linters, linters_do_fixes)
2024-09-18T14:21:01.4525725Z File "/megalinter/MegaLinter.py", line 365, in process_linters_parallel
2024-09-18T14:21:01.4526133Z updated_linters = pool_result.get()
2024-09-18T14:21:01.4526447Z ^^^^^^^^^^^^^^^^^
2024-09-18T14:21:01.4526810Z File "/usr/local/lib/python3.12/multiprocessing/pool.py", line 774, in get
2024-09-18T14:21:01.4527180Z raise self._value
2024-09-18T14:21:01.4527569Z Exception: [Pre][SPELL_CSPELL]: User command failed, stop running MegaLinter
2024-09-18T14:21:01.4528397Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@augment-vir/common/dist/cjs/augments/string/url.js'
2024-09-18T14:21:01.4529317Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@augment-vir/common/dist/esm/augments/string/url.js'
2024-09-18T14:21:01.4530328Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/index.js'
2024-09-18T14:21:01.4531305Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@augment-vir/common/dist/cjs/augments/string/uuid.js'
2024-09-18T14:21:01.4532286Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@augment-vir/common/dist/esm/augments/string/uuid.js'
2024-09-18T14:21:01.4533146Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@cspell/dict-es-es/package.json'
2024-09-18T14:21:01.4534108Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist'
2024-09-18T14:21:01.4535069Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@augment-vir/common/dist/cjs/augments/promise/wait.js'
2024-09-18T14:21:01.4535917Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@cspell/dict-es-es/README.md'
2024-09-18T14:21:01.4536957Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@augment-vir/common/dist/esm/augments/promise/wait.js'
2024-09-18T14:21:01.4538067Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/json-compatible.js'
2024-09-18T14:21:01.4539007Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/tmp/lint/node_modules/@cspell/dict-es-es/src'
2024-09-18T14:21:01.4540187Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/json-compatible.js'
2024-09-18T14:21:01.4541259Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/@augment-vir/common/package.json'
2024-09-18T14:21:01.4542378Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/json.js'
2024-09-18T14:21:01.4543521Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/json.js'
2024-09-18T14:21:01.4544684Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/jsonify.js'
2024-09-18T14:21:01.4545872Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/jsonify.js'
2024-09-18T14:21:01.4547184Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/map-object.js'
2024-09-18T14:21:01.4548336Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/map-object.js'
2024-09-18T14:21:01.4549493Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/merge-deep.js'
2024-09-18T14:21:01.4550658Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/merge-deep.js'
2024-09-18T14:21:01.4552440Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/merge-property-arrays.js'
2024-09-18T14:21:01.4553687Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/merge-property-arrays.js'
2024-09-18T14:21:01.4554869Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/nested-keys.js'
2024-09-18T14:21:01.4556162Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/nested-keys.js'
2024-09-18T14:21:01.4557379Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/object-entries.js'
2024-09-18T14:21:01.4558596Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/object-entries.js'
2024-09-18T14:21:01.4559793Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/object.js'
2024-09-18T14:21:01.4560976Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/object.js'
2024-09-18T14:21:01.4562433Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/old-union-to-intersection.js'
2024-09-18T14:21:01.4563825Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/old-union-to-intersection.js'
2024-09-18T14:21:01.4565046Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/pick-deep.js'
2024-09-18T14:21:01.4566236Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/pick-deep.js'
2024-09-18T14:21:01.4567510Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/string'
2024-09-18T14:21:01.4568621Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/string'
2024-09-18T14:21:01.4569763Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/promise/promise.js'
2024-09-18T14:21:01.4570917Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/promise/promise.js'
2024-09-18T14:21:01.4572104Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/random.js'
2024-09-18T14:21:01.4573258Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/random.js'
2024-09-18T14:21:01.4574392Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/regexp.js'
2024-09-18T14:21:01.4575524Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/regexp.js'
2024-09-18T14:21:01.4576703Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/array/remove-duplicates.js'
2024-09-18T14:21:01.4577924Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/array/remove-duplicates.js'
2024-09-18T14:21:01.4579074Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/string'
2024-09-18T14:21:01.4580193Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/string'
2024-09-18T14:21:01.4581316Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/time.js'
2024-09-18T14:21:01.4582553Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/time.js'
2024-09-18T14:21:01.4583715Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/truncate-number.js'
2024-09-18T14:21:01.4585161Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/truncate-number.js'
2024-09-18T14:21:01.4586303Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/tuple.js'
2024-09-18T14:21:01.4587424Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/tuple.js'
2024-09-18T14:21:01.4588534Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/type.js'
2024-09-18T14:21:01.4589650Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/type.js'
2024-09-18T14:21:01.4590833Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/object/typed-has-property.js'
2024-09-18T14:21:01.4592118Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/object/typed-has-property.js'
2024-09-18T14:21:01.4593270Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/string'
2024-09-18T14:21:01.4594378Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/string'
2024-09-18T14:21:01.4595539Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/promise/wait.js'
2024-09-18T14:21:01.4596700Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/promise/wait.js'
2024-09-18T14:21:01.4597849Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/cjs/augments/wrap-in-try.js'
2024-09-18T14:21:01.4599004Z npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/tmp/lint/node_modules/prettier-plugin-multiline-arrays/node_modules/@augment-vir/common/dist/esm/augments/wrap-in-try.js'
2024-09-18T14:21:01.4599576Z npm error code ENOTEMPTY
2024-09-18T14:21:01.4599896Z npm error syscall rmdir
2024-09-18T14:21:01.4600255Z npm error path /tmp/lint/node_modules/prettier/plugins
2024-09-18T14:21:01.4600615Z npm error errno -39
2024-09-18T14:21:01.4601217Z npm error ENOTEMPTY: directory not empty, rmdir '/tmp/lint/node_modules/prettier/plugins'
2024-09-18T14:21:01.4602075Z npm error A complete log of this run can be found in: /root/.npm/_logs/2024-09-18T14_20_40_948Z-debug-0.log
2024-09-18T14:21:01.4602332Z
2024-09-18T14:21:05.9814000Z
2024-09-18T14:21:05.9866977Z ##[error]PowerShell exited with code '1'.

To Reproduce
Steps to reproduce the behavior:

.mega-linter.yml

JAVASCRIPT_PRETTIER_PRE_COMMANDS:
  - command: npm i prettier-plugin-multiline-arrays
    continue_if_failed: false
    cwd: workspace

JSON_PRETTIER_PRE_COMMANDS:
  - command: npm i prettier-plugin-multiline-arrays
    continue_if_failed: false
    cwd: workspace

YAML_PRETTIER_PRE_COMMANDS:
  - command: npm i prettier-plugin-multiline-arrays
    continue_if_failed: false
    cwd: workspace

.prettierrc.json

{
    "multilineArraysWrapThreshold": -1,
    "plugins": [
        "prettier-plugin-multiline-arrays"
    ]
}
@bdovaz bdovaz added the bug Something isn't working label Sep 18, 2024
@bdovaz
Copy link
Collaborator Author

bdovaz commented Oct 5, 2024

Any ideas?

@nvuillam @echoix

@nvuillam
Copy link
Member

nvuillam commented Oct 5, 2024

@bdovaz sorry I'm struggling for days with ApiReporter not working with flavors, and the big mess with docker hub rate limits while building :(

Copy link
Contributor

github-actions bot commented Nov 5, 2024

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

@github-actions github-actions bot added the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Nov 5, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2024
@bdovaz bdovaz reopened this Nov 19, 2024
@github-actions github-actions bot removed the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Nov 20, 2024
@bdovaz
Copy link
Collaborator Author

bdovaz commented Nov 21, 2024

@nvuillam @echoix

I think I can guess what's going on...

The default is PARALLEL: true.

And I see that although at descriptor level the pre/post are not executed in parallel because that variable is processed later:

pre_post_factory.run_descriptor_pre_commands(self, active_descriptor_id)

pre_post_factory.run_descriptor_post_commands(self, active_descriptor_id)

In the case of linters, pre/post commands are executed in parallel:

self.process_linters_parallel(active_linters, linters_do_fixes)

pre_post_factory.run_linter_pre_commands(self.master, self)

pre_post_factory.run_linter_post_commands(self.master, self)

So as in my case I am installing npm packages I might be entering strange thread race conditions, right?

https://stackoverflow.com/questions/67991537/npm-install-error-enotempty-directory-not-empty#comment129093506_67992047

@nvuillam
Copy link
Member

nvuillam commented Nov 22, 2024

@bdovaz i think that in that case, you shoukd use the main PRE_COMMANDS to ne sure it is run before

Please can you check if it works better like that ? :)

@bdovaz
Copy link
Collaborator Author

bdovaz commented Nov 22, 2024

@nvuillam maybe my message was not clear, disabling the parallel option or putting as you say the commands to the main level works but that limitation we want to leave it like that or solve it?

Because now having changed it to main, I am executing those commands ALWAYS, regardless of whether those prettier linters are going to be executed or not.

@nvuillam
Copy link
Member

Unfortunately, i don't see any other solution, do you ? :/

@bdovaz
Copy link
Collaborator Author

bdovaz commented Nov 22, 2024

The only thing I can think of is to be configurable if all pre/post command at linter level are executed in parallel or not or even decide per command to have an option for it.

@nvuillam
Copy link
Member

The problem is that the whole linters are processed in parallel, including their scoped PRE_COMMANDS, and we can't know before if they'll need to be run or not :/

@bdovaz
Copy link
Collaborator Author

bdovaz commented Nov 23, 2024

But that's what I mean, with a new attribute at the command level to make it more granular or simply at the linter level to be able to decide it and in the code filter out the ones with parallel true or false and process them at the appropriate time.

@nvuillam
Copy link
Member

nvuillam commented Nov 23, 2024

he problem is that the "parallel linters chunks" are build according to the descriptor and apply_fixes ,before we check the content of linter pre-commands :/

While it might be technically possible, it would be a huge impact on the architecture, and with my limited time I don't feel confident to start such task with high risks of regressions , while there is the workaround to put the command in main PRE_COMMANDS :/

@nvuillam
Copy link
Member

(but if you want to try a PR you can ^^ )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants