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

npm install fdq fails with error #5

Open
joshtch opened this issue Mar 26, 2019 · 1 comment
Open

npm install fdq fails with error #5

joshtch opened this issue Mar 26, 2019 · 1 comment

Comments

@joshtch
Copy link

joshtch commented Mar 26, 2019

There does not appear to be a way to install the NPM package.

Steps to reproduce:

$ mkdir test && cd test && npm init
<press enter 10 times>
$ npm install fdq

Error message:


> fdq@0.0.4 install </some/dir>/test/node_modules/fdq
> bin/create-git-hooks.sh

sh: bin/create-git-hooks.sh: No such file or directory
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! fdq@0.0.4 install: `bin/create-git-hooks.sh`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the fdq@0.0.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     </user/dir>/.npm/_logs/<date>-debug.log

This occurs with yarn as well:

$ yarn add fdq

Output:

yarn add v1.13.0
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
error </some/dir>/test/node_modules/fdq: Command failed.
Exit code: 127
Command: bin/create-git-hooks.sh
Arguments:
Directory: </some/dir/>/test/node_modules/fdq
Output:
/bin/sh: bin/create-git-hooks.sh: No such file or directory
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

This same issue and error message arises with fdo and fdp as well.

@joshtch
Copy link
Author

joshtch commented Mar 29, 2019

Ah, this only occurs when fdq is used as a git submodule. You can fix it by modifying bin/create-git-hooks.sh to

#!/bin/bash

echo "Symlinking pre-commit and commit-msg hooks from ${PWD}"

hooksdir="$(git rev-parse --git-dir)/hooks/"
bindir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

relpath() python -c 'import os.path, sys;\
  print os.path.relpath(sys.argv[1],sys.argv[2])' "$1" "${2-$PWD}"
relbindir="$(relpath "$bindir" "$hooksdir")"

ln -s "$relbindir/git-hook-pre-commit.sh" "$hooksdir/pre-commit"
if [ $? = 0 ]; then
  echo "$hooksdir/pre-commit -> $relbindir/git-hook-pre-commit.sh"
fi

ln -s "$relbindir/git-hook-commit-msg.sh" "$hooksdir/commit-msg"
if [ $? = 0 ]; then
  echo "$hooksdir/commit-msg -> $relbindir/git-hook-commit-msg.sh"
fi

ln -s "$relbindir/git-hook-prepare-commit-msg.sh" "$hooksdir/prepare-commit-msg"
if [ $? = 0 ]; then
  echo "$hooksdir/prepare-commit-msg -> $relbindir/git-hook-prepare-commit-msg.sh"
fi

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

No branches or pull requests

1 participant