![](/img/trans.png)
[英]Pipfile.lock out of date / cannot create regular file 'requirements.txt'
[英]Pipfile.lock out of date
我正在嘗試將一個大型 django 項目部署到 heroku。 我安裝了 Heroku CLI,登錄,創建了一個應用程序並運行:
git push heroku master
我已經設置了 Pipfile 和 requirements.txt。 我添加了一個 runtime.txt 來指定我需要 python 2.7。 這也在 Pipfile 中。 這是我從推送到 heroku 得到的:
$ git push heroku master
Counting objects: 12159, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4853/4853), done.
Writing objects: 100% (12159/12159), 20.94 MiB | 1.82 MiB/s, done.
Total 12159 (delta 6859), reused 12036 (delta 6751)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.4
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 11.8.2…
remote: Your Pipfile.lock (3b2ba9) is out of date. Expected: (83a5b4).
remote: Aborting deploy.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy....
remote:
remote: ! Push rejected to camp-infinity.
remote:
To https://git.heroku.com/camp-infinity.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/camp-infinity.git'
出於某種原因,它嘗試安裝 python 3,而且它也不喜歡我的 Pipfile.lock 文件。 我嘗試刪除它並使用 pipenv install 再次生成它,但這並沒有改變任何東西。
在做項目時遇到同樣的問題,在你推送到 Heroku 的分支中,運行
pipenv lock
它將更新 Pipfile.lock 文件。 :)
我刪除了Pipfile.lock
並承諾將其刪除。 Heroku 的構建過程抱怨它不存在,但它確實部署成功......
-----> Python app detected
! No 'Pipfile.lock' found! We recommend you commit this into your repository.
-----> Installing pip
-----> Installing dependencies with Pipenv 11.8.2…
Installing dependencies from Pipfile…
-----> Discovering process types
Procfile declares types -> worker
-----> Compressing...
Done: 189.9M
-----> Launching...
Released v5
更新我的 pipenv: pip install pipenv --upgrade
然后做: pipenv lock
然后做一個提交
幫我修好了
如果已經創建了 Pipfile,請將其刪除並再次推送部署。 它應該重新安裝您的依賴項。 這對我有用。
處理這個問題的最簡單方法是運行: pipenv lock
然后git commit -am "updated pipfile"
, git push && git push heroku master
這些命令與其他答案中列出的其他一些命令完全相同,但是,這些命令可能會更快一些。
我今天遇到了同樣的問題,所以我通過更新我的 pipenv - pip install pipenv --upgrade
然后點擊pipenv lock
解決了下面提到的那個人。 這是要走的路,可以解決大多數情況。 另外,在那之后不要忘記 git add、commit 並推送到 heroku! 希望有幫助!
您應該提供:
Pipfile
和對應Pipfile.lock
要么
requirements.txt
(和可選的runtime.txt
) 如果您使用的是Pipfile
,那么git rm requirements.txt runtime.txt
並確保git add Pipfile Pipfile.lock
。 git commit
然后嘗試將git push
到 heroku。
我有同樣的問題,這是由於指向 Pipfile.lock 的符號鏈接。
在我的本地 mac OS 環境中克隆 repo 后,由於某些原因,原始鏈接有點損壞,這導致Your Pipfile.lock (3b2ba9) is out of date. Expected: (83a5b4)
Your Pipfile.lock (3b2ba9) is out of date. Expected: (83a5b4)
推送到 Heroku 時。
只需刪除“舊”符號鏈接並從我的本地環境中重新創建它即可解決問題。
使用 Heroku CLI,我從一個不是master
的本地分支運行git push heroku master
時,出現了這個確切的錯誤:
remote: -----> Python app detected
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18…
remote: Your Pipfile.lock (38bf21) is out of date. Expected: (e4987e).
remote: Aborting deploy.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
從master
分支部署修復了它。
如果要將本地分支推送到非master
的 Heroku master,請運行git push heroku branchname:master
。
另一個提示:確保執行git add.
和git commit -m "whatever"
如果你更新了你的Pipfile.lock
並且沒有看到任何變化。 :)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.