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

prettier fails to install #1670

Closed
WhyNotHugo opened this issue Oct 29, 2020 · 3 comments
Closed

prettier fails to install #1670

WhyNotHugo opened this issue Oct 29, 2020 · 3 comments
Labels

Comments

@WhyNotHugo
Copy link

I'm using prettier's hook, and it's failing to run all of a sudden:

❯ pre-commit run prettier
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/hugo/.cache/pre-commit/patch1603988462.
[INFO] Installing environment for https://github.com/prettier/prettier.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Restored changes from /home/hugo/.cache/pre-commit/patch1603988462.
An unexpected error has occurred: CalledProcessError: command: ('/home/hugo/.cache/pre-commit/repow3gefvtb/node_env-system/bin/node', '/usr/bin/npm', 'install', '--dev', '--prod', '--ignore-prepublish', '--no-progress', '--no-save')
return code: 1
expected return code: 0
stdout: (none)
stderr:
    npm WARN install Usage of the `--dev` option is deprecated. Use `--include=dev` instead.
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! While resolving: prettier@2.1.2
    npm ERR! Found: remark-parse@8.0.3
    npm ERR! node_modules/remark-parse
    npm ERR!   remark-parse@"8.0.3" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer remark-parse@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" from remark-math@1.0.6
    npm ERR! node_modules/remark-math
    npm ERR!   remark-math@"1.0.6" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR!
    npm ERR! See /home/hugo/.npm/eresolve-report.txt for a full report.

    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/hugo/.npm/_logs/2020-10-29T16_21_07_309Z-debug.log

Check the log at /home/hugo/.cache/pre-commit/pre-commit.log
  • I was on pre-commit 2.6.0, but updating to 2.8.1 changed nothing.
  • My hooks are pinned, so I'm running everything on the same version.

Any hints here? I can't quite figure out what's changed, or where.

@asottile
Copy link
Member

there's a duplicate somwhere but I'm having trouble finding what repository it was in, I thought it was here but it might be one of the prettier repos now that I think about it

node 15 (and new npm) were released which breaks the dependencies pinned (and conflicting) in prettier 2.1.1's package.json (which I assume is the one you're using since I can't see the configuration?)

there's a couple ways around this:

  • I believe prettier 2.1.2 doesn't have this problem
  • prettier is currently migrating from prettier/prettier to prettier/pre-commit -- maybe try this other repository instead?
  • you could pick a particular node version using language_version
  • you could globally install node and then the language_version will default to system

@asottile asottile changed the title node hooks fail to run prettier fails to install Oct 29, 2020
@asottile
Copy link
Member

found it! prettier/prettier#9459

@WhyNotHugo
Copy link
Author

Ah, thanks! I never would have guessed that was the issue.

Moved to using https://github.com/prettier/pre-commit, and that fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants