Skip to content

Instantly share code, notes, and snippets.

@cjolowicz
Created April 15, 2020 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjolowicz/82c1bdd93d1125c9956ede1c03687483 to your computer and use it in GitHub Desktop.
Save cjolowicz/82c1bdd93d1125c9956ede1c03687483 to your computer and use it in GitHub Desktop.
pre-commit cannot install Prettier environment
repos:
- repo: https://github.com/prettier/prettier
rev: 2.0.4
hooks:
- id: prettier

pre-commit 2.2.0 fails during environment installation for Prettier 2.0.4, due to a dependency error:

#15 0.424 [INFO] Initializing environment for https://github.com/prettier/prettier.
#15 9.104 [INFO] Installing environment for https://github.com/prettier/prettier.
#15 9.105 [INFO] Once installed this environment will be reused.
#15 9.105 [INFO] This may take a few minutes...
#15 59.61 An unexpected error has occurred: CalledProcessError: command: ('/root/.cache/pre-commit/repoaojfpcqy/node_env-default/bin/node', '/root/.cache/pre-commit/repoaojfpcqy/node_env-default/bin/npm', 'install')
#15 59.61 return code: 1
#15 59.61 expected return code: 0
#15 59.61 stdout: (none)
#15 59.61 stderr:
#15 59.61     npm WARN deprecated json-parser@1.1.5: `json-parser` is deprecated. Please use `comment-json` instead
#15 59.61     npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
#15 59.61     npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
#15 59.61     npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
#15 59.61     npm ERR! code ETARGET
#15 59.61     npm ERR! notarget No matching version found for @glimmer/interfaces@^0.50.3.
#15 59.61     npm ERR! notarget In most cases you or one of your dependencies are requesting
#15 59.61     npm ERR! notarget a package version that doesn't exist.
#15 59.61     npm ERR! notarget
#15 59.61     npm ERR! notarget It was specified as a dependency of '@glimmer/util'
#15 59.61     npm ERR! notarget
#15 59.61
#15 59.61     npm ERR! A complete log of this run can be found in:
#15 59.61     npm ERR!     /root/.npm/_logs/2020-04-15T14_56_13_637Z-debug.log
#15 59.61
#15 59.61 Check the log at /root/.cache/pre-commit/pre-commit.log

Prettier 2.0.4 installs fine from yarn:

$ yarn init --yes
$ yarn add --dev prettier                                                                                                                     347ms ξ‚³ 17:00
yarn add v1.22.4
info No lockfile found.
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
[4/4] πŸ”¨  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ prettier@2.0.4
info All dependencies
└─ prettier@2.0.4
✨  Done in 0.49s.
FROM python:3.8.2
RUN apt-get update && apt-get install -y --no-install-recommends git
RUN pip install pre-commit==2.2.0
WORKDIR /app
COPY .pre-commit-config.yaml ./
RUN git init
RUN git config --local user.name "Your Name"
RUN git config --local user.email "you@example.com"
RUN git add . && git commit --message="Initial commit"
RUN pre-commit run --all-files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment