Sea*_*404 6 heroku package-managers node.js server yarnpkg
我试图使用CLI在Heroku上部署React Web应用程序.但是当我跑的时候,
git push heroku master
Run Code Online (Sandbox Code Playgroud)
从我的项目文件夹中它会抛出一个错误:
Counting objects: 213, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (212/212), done.
Writing objects: 100% (213/213), 515.89 KiB | 0 bytes/s, done.
Total 213 (delta 40), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Build failed
remote: ! Two different lockfiles found: package-lock.json and
yarn.lock
remote:
remote: Both npm and yarn have created lockfiles for this
application,
remote: but only one can be used to install dependencies.
Installing
remote: dependencies using the wrong package manager can
result in missing
remote: packages or subtle bugs in production.
remote:
remote: - To use npm to install your application's
dependencies please delete
remote: the yarn.lock file.
remote:
remote: $ git rm yarn.lock
remote:
remote: - To use yarn to install your application's
dependences please delete
remote: the package-lock.json file.
remote:
remote: $ git rm package-lock.json
remote:
remote: https://kb.heroku.com/why-is-my-node-js-build-
failing-because-of-conflicting-lock-files
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to MyAPP.
remote:
To https://git.heroku.com/MyAPP.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to
'https://git.heroku.com/MyAPP.git'
Run Code Online (Sandbox Code Playgroud)
因为我使用npm,所以我做了rm并删除了纱线锁文件.仍出现同样的错误.现在,当我真的做rm yarn.lock时,我在终端找到了一个没有条目.Idk为什么Heroku CLI坚持我仍然在目录中有纱线锁定文件.
小智 13
在将其推送到Heroku之前,您是否已经回到主分支?
最常见的是,当我进行代码更改然后'git push heroku master'时出现这样的问题但是我的主分支还没有更新,因为我还没有提交我的本地更改.
尝试
git commit -m 'some changes'
Run Code Online (Sandbox Code Playgroud)
然后
git push heroku master
Run Code Online (Sandbox Code Playgroud)
小智 8
If you use npm:
git rm yarn.lock
git commit -m "Remove yarn lock file"
git push heroku master
Run Code Online (Sandbox Code Playgroud)
If you use yarn:
git rm package-lock.json
git commit -m "Remove npm lock file"
git push heroku master
Run Code Online (Sandbox Code Playgroud)
小智 5
删除yarn.lock和package-lock.json及其后面的内容:
git add --all
git commit -a -m "Delete yarn lock and package lock"
git push
git push heroku master
Run Code Online (Sandbox Code Playgroud)
这对我行得通!
| 归档时间: |
|
| 查看次数: |
5468 次 |
| 最近记录: |