BBa*_*ger 1 javascript git heroku create-react-app
按照这个: https: //dev.to/smithmanny/deploy-your-react-app-to-heroku-2b6f,我试图将一个简单的React应用程序从create-react-app部署到Heroku。
npx create-react-app my-app
cd my-app
npm install
Run Code Online (Sandbox Code Playgroud)
然后将这些添加到 package.json 中:
"engines": {
"npm": "6.12.0",
"node": "10.16.3"
},
Run Code Online (Sandbox Code Playgroud)
然后:
heroku login blah...
git init
git add .
git commit -m "initial commit"
heroku create
git remote add heroku https://git.heroku.com/damp-spire-48480.git (auto-generated name of app)
git push heroku master
Run Code Online (Sandbox Code Playgroud)
然后我得到这个:
Enumerating objects: 27666, done.
Counting objects: 100% (27666/27666), done.
Delta compression using up to 8 threads
Compressing objects: 100% (20069/20069), done.
Writing objects: 100% (27666/27666), 24.31 MiB | 362.00 KiB/s, done.
Total 27666 (delta 5987), reused 27666 (delta 5987)
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://help.heroku.com/0KU2EM53
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to damp-spire-48480.
remote:
To https://git.heroku.com/damp-spire-48480.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/damp-spire-48480.git'
Run Code Online (Sandbox Code Playgroud)
我现在已经看了一些SO页面,到目前为止还没有看到解决方案。我不应该在那里有一些应用程序和遥控器,但我想我已经删除了所有应用程序和遥控器,并尝试从头开始......除非还有其他东西需要清理......
我尝试了这个:Push to Heroku被拒绝-“无法将一些引用推送到‘heroku’”。所以我尝试了:git push heroku master:master和git push heroku HEAD:master每次都得到相同的结果。
如果那里有一个,你稍后将其删除,那么它仍然会失败。
如果您删除它并提交,则不应该记录删除:
正如 Heroku 页面中所解释的“为什么我的 Node.js 构建会因为锁定文件冲突而失败? ”
git rm yarn.lock
git commit -m "Remove yarn lock file"
git push heroku master
Run Code Online (Sandbox Code Playgroud)
和/或
git rm package-lock.json
git commit -m "Remove npm lock file"
git push heroku master
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1407 次 |
| 最近记录: |