首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Heroku engines.node (package.json)未指定

Heroku engines.node (package.json)未指定
EN

Stack Overflow用户
提问于 2020-04-07 06:47:08
回答 3查看 2.6K关注 0票数 1

我很难把我的密码推给Heroku。

package.json

代码语言:javascript
运行
复制
{
  "name": "my-app",
  "version": "0.1.0",
  "engine": {
    "node": "12.16.2",
    "npm": "6.13.4"
  },
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "bcrypt": "^4.0.1",
    "body-parser": "^1.18.3",
    "cookie-parser": "^1.4.3",
    "express": "^4.17.1",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.4.20",
    "nodemon": "^2.0.2",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "node server/index.js",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "backend": "nodemon server/index.js"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

输出

代码语言:javascript
运行
复制
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.16.1...
remote:        Using default npm version: 6.13.4
<!-- more stuff -->
remote: -----> Build
remote:        Running build
remote:        
remote:        > my-app@0.1.0 build /tmp/build_016788c07037e47ee5638bf5c1b1f631
remote:        > react-scripts build
remote:
remote:        Could not find a required file.
remote:          Name: index.html
remote:          Searched in: /tmp/build_016788c07037e47ee5638bf5c1b1f631/public
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! my-app@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the my-app@0.1.0 build script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.yXjxR/_logs/2020-04-11T07_16_57_245Z-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:        Some possible problems:
remote:
remote:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed

如您所见,即使我在package.json中指定了我的节点和npm版本,Heroku没有识别它,我的推送也被拒绝了。我试着在Heroku网站上订票,但是由于这是一个免费的应用程序,他们不允许我在他们的帮助热线上询问。

编辑

我将npm和节点版本升级为Heroku的默认版本,但我得到了错误Could not find a required file.Name: index.html

EN

Stack Overflow用户

发布于 2020-04-16 02:32:43

我也有过同样的问题。看来Heroku还不支持12.16.2。在package.json引擎部分尝试使用12.16.1。

改变这个

“引擎”:{“节点”:"12.16.2","npm":"6.13.4“},

“引擎”:{“节点”:"12.16.1","npm":"6.14.4“},

票数 3
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61074260

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档