如何解决在Heroku上部署react应用时出现的错误
我在本地为我的项目运行yarn install
和yarn start
,它工作得很好。但是,一旦我将其推送到Heroku,我就无法部署它,并显示以下错误日志:
2021-05-10T16:40:06.622555+00:00 app[web.1]: > react-scripts start
2021-05-10T16:40:06.622556+00:00 app[web.1]:
2021-05-10T16:40:06.627252+00:00 app[web.1]: sh: 1: react-scripts: not found
2021-05-10T16:40:06.636894+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-05-10T16:40:06.637303+00:00 app[web.1]: npm ERR! syscall spawn
2021-05-10T16:40:06.637496+00:00 app[web.1]: npm ERR! file sh
2021-05-10T16:40:06.637766+00:00 app[web.1]: npm ERR! errno ENOENT
2021-05-10T16:40:06.644457+00:00 app[web.1]: npm ERR! bleh@0.1.0 start: `react-scripts start`
2021-05-10T16:40:06.644627+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-05-10T16:40:06.644771+00:00 app[web.1]: npm ERR!
2021-05-10T16:40:06.644922+00:00 app[web.1]: npm ERR! Failed at the bleh@0.1.0 start script.
2021-05-10T16:40:06.645043+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-05-10T16:40:06.654910+00:00 app[web.1]:
2021-05-10T16:40:06.655128+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-05-10T16:40:06.655306+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-05-10T16_40_06_646Z-debug.log
2021-05-10T16:40:06.706089+00:00 heroku[web.1]: Process exited with status 1
2021-05-10T16:40:06.778374+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-10T16:41:26.103511+00:00 app[api]: Deploy 1f4ec645 by user holliu9999@gmail.com
2021-05-10T16:41:26.103511+00:00 app[api]: Release v7 created by user holliu9999@gmail.com
2021-05-10T16:41:26.390448+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-10T16:41:30.000000+00:00 app[api]: Build succeeded
2021-05-10T16:41:32.398941+00:00 heroku[web.1]: Starting process with command `npm start`
另外,我在我的目录中只包含了yarn.lock
,所以我搞不懂为什么它还在运行npm。下面是我的package.json
文件:
{
"name": "bleh",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "0.9.0"
},
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-fontawesome": "^1.6.1",
"react-infinite": "^0.11.2",
"react-infinite-loader": "^1.0.2",
"react-router": "^3.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
转载请注明出处:http://www.zhongtian365.com/article/20230505/2542679.html
随机推荐
-
如何解决在iOS上构建颤动应用失败的问题?
我已经将Firebase Core和Auth pubs添加到我的项目中。在那之后,我不能在iOS上运行我的项目并得到几个错误,我试图修复这些错误。目前我决定从我的项目中删除firebase代码,但仍然收到错误。这里是错误堆栈:ptyLogD...
-
如何解决在IBM云中的Db2-oc中创建新凭据时出现的错误500,Internal Server error“?
This is the error which I am getting on creating new credential in service credential of Db2-oc in IBM cloud
-
如何解决在mac上编译drake时出现的g_iprint错误?
我在mac上编译程序时遇到了这个错误。external/drake/solvers/snopt_solver.cc:118:34: error: variable g_iprint is not needed and will not be...
-
如何解决在ec2 tomcat上部署spring启动代码时出现的404错误?
我在tomcat的webapps文件夹(ROOT.war)下的ec2实例上部署了spring引导war文件和解压缩文件,但是在webapps文件夹WEB-INF文件夹中创建了WEB-INF文件夹,我将WEB-INF重命名为根并尝试通过pos...
-
如何解决在bitbucket管道中通过xdist并行运行pytest时出现的错误
我们在bitbucket管道中执行python代码库的单元测试。最近,我们开始使用pytest-xdist (https://pypi.org/project/pytest-xdist/)包,并在通过coverage run -m pyte...
-
如何解决在WinML中加载ONNX模型时出现的REGDB_E_CLASSNOTREG“错误
我正在尝试重现https://docs.microsoft.com/en-us/windows/ai/windows-ml/get-started-desktop中描述的WinML教程,在加载模型时需要帮助解决Access violatio...
-
如何解决在类路径中重写mssql-jdbc驱动程序时出现的错误-在类中找不到Main方法
我希望我的java应用程序使用jdbc 7.4.1版本。经过研究,我发现重写类路径是一种方法。但是我的误差越来越小了。环境: RHEL重写类路径java -cp /home/xyz/sqljdbc_7.4/enu/mssql-jdbc-7....
-
如何解决在包含子模块的项目中合并时出现“error: add_cacheinfo刷新路径失败”的问题
我有一个带有子模块的项目。当尝试将分支(名为release)合并到master中时,git发现了一些冲突,并引发了以下错误:Fast-forwarding submodule path/to/submodule Auto-merging p...
-
如何解决在两个兄弟文件夹中导入相同的库时出现的错误?
我的应用程序中有一个无法解决的导入问题。我的结构如下所示:mnt | |---setup.sh | |---parentfolder | |---subfolder1 | ...
-
如何解决在服务器下子文件夹中部署laravel后出现的404错误?
我已经在服务器的public_html目录下的一个子文件夹中上传了一个laravel项目。例如www.xyz.com/subfolder。Bot我收到错误404没有找到。我的htaccess代码IfModule mod_rewrite.c ...