![](/img/trans.png)
[英]ERROR in ./app/main.js Module build failed: SyntaxError: Unexpected token (10:18)
[英]Node app in Heroku: Module build failed: Error: Unexpected "space" found
我有一个节点应用程序已经在 Heroku 上运行了一年,但是最后一次更新现在在构建时崩溃了。 我以前从未见过此错误,也找不到任何帮助。
这是错误日志:
yarn run v1.12.3
$ react-scripts build
Creating an optimized production build...
Failed to compile.
./src/components/Admin_Navigation/navigation.css
Module build failed: Error: Unexpected "space" found.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sonar@1.0.0 heroku-postbuild: `yarn build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sonar@1.0.0 heroku-postbuild 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! /tmp/npmcache.22xgq/_logs/2018-11-22T00_36_38_522Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Dangerous semver range (>) in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
我尝试了以下方法:
您的任何想法都值得赞赏。 谢谢
更新:这是由 CSS 中不必要的空间引起的。 您可以手动查看 CSS 以查找空间,或者一个不太理想的解决方案是将 Node 回滚到语法不那么严格的版本。
我遇到了与此类似的问题,帮助我的是逐行搜索问题,最后它是:
和导致问题的 CSS 文件中的hover
之间的意外空间。
令人惊讶的是,我从未更改过该代码并且它以前可以工作,但解决方案是在我的 CSS 文件中实际找到正在讨论的空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.