簡體   English   中英

Pipfile.lock 已過期

[英]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! 希望有幫助!

您應該提供:

  1. Pipfile和對應Pipfile.lock

要么

  1. requirements.txt (和可選的runtime.txt

如果您使用的是Pipfile ,那么git rm requirements.txt runtime.txt並確保git add Pipfile Pipfile.lock git commit然后嘗試將git push到 heroku。

https://devcenter.heroku.com/articles/python-runtimes

我有同樣的問題,這是由於指向 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM