gpt4 book ai didi

javascript - 推送到 Heroku 时 Node.js 应用程序无法构建

转载 作者:太空宇宙 更新时间:2023-11-04 01:31:12 25 4
gpt4 key购买 nike

我是编码新手,目前正在根据本教程使用 Node.js 为 Shopify 开发嵌入式应用程序。 (https://developers.shopify.com/tutorials/build-a-shopify-app-with-node-and-react)

我的应用程序在本地运行良好,但在推送到 Heroku 时无法构建。我已经尝试了在网上可以找到的所有解决方案,但没有一个有效。我的代码好像有语法错误,但是我已经删除了那部分,为什么错误仍然存​​在?

-----> Build
Running build

> collection-generator-app@1.0.0 build /tmp/build_9491321e44d82596e81efddc7086d165
> next build

Creating an optimized production build ...

Failed to compile.
./pages/fetch-query.js
SyntaxError: /tmp/build_9491321e44d82596e81efddc7086d165/pages/fetch-query.js: Unterminated JSX contents (34:9)
32 |
33 | return (
> 34 | <div>
| ^
35 |
36 | );
37 | }}
> Build error occurred
Error: > Build failed because of webpack errors
at Object.build [as default] (/tmp/build_9491321e44d82596e81efddc7086d165/node_modules/next/dist/build/index.js:101:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! collection-generator-app@1.0.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the collection-generator-app@1.0.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! /tmp/npmcache.Galdd/_logs/2019-05-09T04_23_39_145Z-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:

- node_modules checked into source control
https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits

- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

Love,
Heroku

! Push rejected, failed to compile Node.js app.
! Push failed

这是我的 package.json

{
"name": "collection-generator-app",
"version": "1.0.0",
"description": "",
"engines": {
"node": "10.15.2",
"npm": "6.4.1"
},
"main": "index.js",
"scripts": {
"dev": "node server.js",
"start": "next start",
"build": "next build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@shopify/koa-shopify-auth": "^3.1.18",
"@shopify/koa-shopify-graphql-proxy": "^2.1.5",
"@shopify/polaris": "^3.11.0",
"@zeit/next-css": "^1.0.1",
"apollo-boost": "^0.3.1",
"dotenv": "^7.0.0",
"graphql": "^14.1.1",
"isomorphic-fetch": "^2.2.1",
"js-cookie": "^2.2.0",
"js-cookies": "^1.0.4",
"koa": "^2.7.0",
"koa-session": "^5.10.1",
"next": "^8.0.3",
"react": "^16.8.4",
"react-apollo": "^2.5.3",
"react-dom": "^16.8.4"
}
}

最佳答案

您的 fetch-query.js 文件中的 div 标签应该有一个结束标签。

如果您已经这样做了,请提交更改并推送到heroku。通常,您可以这样做:

  • git add .
  • git commit -m“修复结束标记”
  • git Push heroku master

但这取决于你如何配置 git。

如果你想保留div标签,请查看the Fragments API

关于javascript - 推送到 Heroku 时 Node.js 应用程序无法构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56053268/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com