在 heroku "Failed to minify the code from this file" 上反应应用程序部署失败



我使用 create-react-app 命令创建了一个反应应用程序,并尝试按照 https://github.com/mars/create-react-app-buildpack#quick-start 上的说明将其部署到 heroku 上

但是,在尝试推送到 heroku 时,我想出了以下构建失败,其中构建日志读取:

Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file: 
./node_modules/newsapi/index.js:17 
Read more here: 
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sports-news-app@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sports-news-app@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional 
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /app/.npm/_logs/2018-08-15T03_41_33_617Z-debug.log
!     Push rejected, failed to compile React.js (create-react-app) multi app.
!     Push failed

newsapi/index.js在第17行读到:

let API_KEY; // To be set by clients

如果不看到newsapi/index.js,很难说错误可能是什么。该文件可能包含不支持或无法缩小的语法。一种解决方案是查看该行是否为导入,并创建该依赖项的本地版本,并删除或更新有问题的语法。

相关内容

最新更新