husky: Pre-push fail : unable to import Django in pre-push after husky upgrade
Hi,
I upgraded on my macOS 10.13.6 my node to v10.16.0 and husky to v3.0.0 and since this moment the pre-push for my Django project fails with this error :
husky > pre-push (node v10.16.0) yarn run v1.5.1 $ python manage.py test --settings=MyDjangoProject.settings.dev MyDjangoProject/unit_tests/ --parallel 8 --noinput Traceback (most recent call last): File “manage.py”, line 17, in <module> "Couldn’t import Django. Are you sure it’s installed and " ImportError: Couldn’t import Django. Are you sure it’s installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? error An unexpected error occurred: "Command failed. Exit code: 1 Command: sh Arguments: -c python manage.py test --settings=MyDjangoProject.settings.dev MyDjangoProject/unit_tests/ --parallel 8 --noinput Directory: /Users/Yoann/Pro/git_projects/MyDjangoProject Output: ". info If you think this is a bug, please open a bug report with the information provided in “/Users/Yoann/Pro/git_projects/MyDjangoProject/yarn-error.log”. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. husky > pre-push hook failed (add --no-verify to bypass) error: failed to push some refs to ‘git@gitlab.fr:myComp/MyDjangoProject.git’
I work with pyenv and virtualenv and it was ok before the upgrade. I tried to :
rm -rf .git/hooks/ npm i -D husky@3.0.0
but the error is still here…
I can run python manage.py test --settings=MyDjangoProject.settings.dev MyDjangoProject/unit_tests/ --parallel 8 --noinput
without any problems in my env.
I printed which python
in the .git/hooks/pre-push file to check if it’s ok and it is (the same as in my env).
Now, I’m lost and I’m wondering if my best solution is to remove all this mess and reinstall it from scratch …
To conclude, the error in yarn-error.log is :
Trace: Error: Command failed. Exit code: 1 Command: sh Arguments: -c python manage.py test --settings=MyDjangoProject.settings.dev MyDjangoProject/unit_tests/ --parallel 8 --noinput Directory: /Users/Yoann/Pro/git_projects/MyDjangoProject Output:
at ProcessTermError.MessageError (/usr/local/lib/node_modules/yarn/lib/cli.js:186:110)
at new ProcessTermError (/usr/local/lib/node_modules/yarn/lib/cli.js:226:113)
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/yarn/lib/cli.js:30281:17)
at ChildProcess.emit (events.js:198:13)
at maybeClose (internal/child_process.js:982:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
Thanks a lot for your help.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (6 by maintainers)
🎉 🙂