问题描述
我正在尝试通过 Heroku 托管我的 React 应用程序(使用 mongodb 后端)。
这是我第一次运行 Heroku,ReactApp 是在 Heroku 实现之前构建的。我的最终目标是一次性托管 MongoDB 后端和 React 前端。
文件通过 Github 托管到 Heroku 我遵循教程并上传了所有内容,但我一次又一次地遇到此错误:
npm ERR! (Insert Dependancy here)valid-url not accessible from @heroku-cli/plugin-buildpacks
通常表现为:
npm ERR! valid-url not accessible from u/heroku-cli/plugin-buildpacks
npm ERR! @heroku/buildpack-registry not accessible from @heroku-cli/plugin-buildpacks
我在这里试过答案:[https://stackoverflow.com/questions/64629076/heroku-heroku-buildpack-registry-not-accessible-from-heroku-cli-plugin-buil][1]
(稍作改动,推出:npm i @heroku/buildpack-registry valid-url
而不是建议的解决方案)但没有奏效。
我尝试删除/重新安装 package-lock.json,删除并重新安装 @heroku-cli/plugin-buildpacks 几次,然后删除并重新安装(使用 npm i
)我的 node_modules 文件夹(和 package.lock ) 多次,但问题仍然存在。
我尝试重新安装它要求的依赖项(valid-url 或 @heroku/buildpack-registry),但没有效果。
我还尝试通过命令行(使用 git push heroku master
)部署应用程序并通过 Heroku 网络应用程序部署它,但这些会产生相同的结果。
我已将其缩小为 buildpack 问题,但不确定下一步该去哪里。我注意到 Heroku 支持自定义 buildpacks 存储库(例如用于 create-react-app 等),但我担心这会打开一个全新的蠕虫罐。非常感谢您的帮助!
这是我的 Package.json(错误消息如下。如果您需要更多文件或详细信息,请告诉我)
{
"name": "tracker","version": "0.1.0","private": true,"dependencies": {
"@testing-library/jest-dom": "^5.11.6","@testing-library/react": "^11.2.2","@testing-library/user-event": "^12.6.0","axios": "^0.21.1","bootstrap": "^4.6.0","heroku": "^7.50.0","node-sass": "^4.14.1","react": "^17.0.1","react-bootstrap": "^1.4.3","react-datepicker": "^3.4.1","react-dom": "^17.0.1","react-router-dom": "^5.2.0","react-scripts": "4.0.1","sweetalert2": "^10.15.5","sweetalert2-react-content": "^3.3.1","web-vitals": "^0.2.4"
},"engines": {
"node": "10.15.x"
},"scripts": {
"start": "react-scripts start","build": "react-scripts build","test": "react-scripts test","eject": "react-scripts eject"
},"eslintConfig": {
"extends": [
"react-app","react-app/jest"
]
},"browserslist": {
"production": [
">0.2%","not dead","not op_mini all"
],"development": [
"last 1 chrome version","last 1 firefox version","last 1 safari version"
]
},"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).","main": "index.js","keywords": [],"author": "","license": "ISC","repository": {
"type": "git","url": "git+https://github.com/nMckenryan/rpgtracker.git"
},"bugs": {
"url": "https://github.com/nMckenryan/rpgtracker/issues"
},"homepage": "/"
}
这是我一直看到的错误消息:
$ git push heroku master
Enumerating objects: 19,done.
Counting objects: 100% (19/19),done.
Delta compression using up to 4 threads
Compressing objects: 100% (13/13),done.
Writing objects: 100% (13/13),125.39 KiB | 828.00 KiB/s,done.
Total 13 (delta 9),reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONfig_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 10.15.x
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 10.15.x...
remote: Downloading and installing node 10.15.3...
remote: Using default npm version: 6.4.1
remote:
remote: -----> Restoring cache
remote: - node_modules
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! @heroku/buildpack-registry not accessible from @heroku-cli/plugin-buildpacks
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.M9Bs3/_logs/2021-03-09T15_25_49_297Z-debug.log
remote:
remote: -----> Build Failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck,please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: love,remote: Heroku
remote:
remote: ! Push rejected,Failed to compile Node.js app.
remote:
remote: ! Push Failed
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)