简体   繁体   English

当本地构建工作正常时,heroku 部署不起作用 - NodeJS 超时

[英]heroku deploy not working when local build works fine - NodeJS Timeout

Title says it really - i can build locally but it fails to deploy.标题确实说明了这一点 - 我可以在本地构建,但无法部署。 Has an issue with Timeout - not sure how to force this to work?超时有问题 - 不知道如何强制它工作?

Here's my package.json, and the logs afterwards.这是我的 package.json,以及之后的日志。

I tried adding Timeout by running a yarn install but then it triggered some other dependency issues with node-gyp我尝试通过运行 yarn install 添加超时,但随后它触发了 node-gyp 的其他一些依赖问题

Many thanks for any tips!非常感谢您的任何提示!

Package.json包.json

{
  "name": "api",
  "homepage": ".",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "lint": "eslint .",
    "dev": "NODE_ENV=development nodemon --watch '**/*' -e ts,tsx,js  --ignore 'src/**/*.spec.ts' --exec 'ts-node --project ./tsconfig.json' src/server.ts",
    "start": "node ./dist/server.js",
    "start:redis": "docker-compose up -d",
    "build": "NODE_ENV=production tsc"
  },
  "engines":{
    "node":"14.15.5",
    "npm": "6.14.11",
    "yarn": "1.22.15"
  },
  "license": "MIT",
  "main": "dist/server.js",
  "devDependencies": {
    "@types/cookie": "^0.4.0",
    "@types/puppeteer": "^5.4.4",
    "@types/ramda": "^0.27.44",
    "@types/redis": "^2.8.31",
    "@types/user-agents": "^1.0.2",
    "@typescript-eslint/eslint-plugin": "^4.19.0",
    "@typescript-eslint/parser": "^4.19.0",
    "eslint": "^7.22.0",
    "eslint-config-prettier": "^8.1.0",
    "nodemon": "^2.0.12",
    "prettier": "~2.2.1",
    "tslib": "^2.0.0",
    "typescript": "^4.0.0"
  },
  "dependencies": {
    "axios": "^0.21.1",
    "body-parser": "^1.19.0",
    "chalk": "^4.1.2",
    "cookie": "^0.4.1",
    "cookie-parser": "^1.4.5",
    "cors": "^2.8.5",
    "dotenv": "^10.0.0",
    "express": "^4.17.1",
    "express-async-router": "^0.1.15",
    "express-query-boolean": "^2.0.0",
    "node-fetch": "^2.6.1",
    "puppeteer": "^10.2.0",
    "puppeteer-extra": "^3.1.18",
    "puppeteer-extra-plugin-adblocker": "^2.11.11",
    "puppeteer-extra-plugin-stealth": "^2.7.8",
    "ramda": "^0.27.1",
    "redis": "^3.1.2",
    "user-agents": "^1.0.738",
    "util": "^0.12.4"
  }
}

Build logs构建日志

> 

-----> Building on the Heroku-20 stack

-----> Using buildpack: heroku/nodejs

-----> Node.js app detected

       

-----> Creating runtime environment

       

       NPM_CONFIG_LOGLEVEL=error

       NODE_VERBOSE=false

       NODE_ENV=production

       NODE_MODULES_CACHE=true

       

-----> Installing binaries

       engines.node (package.json):  14.15.5

       engines.npm (package.json):   6.14.11

       engines.yarn (package.json):  1.22.15

       

       Resolving node version 14.15.5...

       Downloading and installing node 14.15.5...

       npm 6.14.11 already installed with node

       Resolving yarn version 1.22.15...

       Downloading and installing yarn (1.22.15)

       Installed yarn 1.22.15

       

-----> Restoring cache

       Cached directories were not restored due to a change in version of node, npm, yarn or stack

       Module installation may take longer for this build

       

-----> Installing dependencies

       Installing node modules (package.json)

       

       > puppeteer@10.4.0 install /tmp/build_e4061cb3/node_modules/puppeteer

       > node install.js

       

       

       

       > nodemon@2.0.13 postinstall /tmp/build_e4061cb3/node_modules/nodemon

       > node bin/postinstall || exit 0

       

       Love nodemon? You can now support the project via the open collective:

        > https://opencollective.com/nodemon/donate

       

       added 477 packages from 392 contributors and audited 479 packages in 31.801s

       

       76 packages are looking for funding

         run `npm fund` for details

       

       found 0 vulnerabilities

       

       

-----> Build

       Running build

       

       > api@0.0.1 build /tmp/build_e4061cb3

       > NODE_ENV=production tsc

       

       node_modules/puppeteer/lib/types.d.ts(3644,28): error TS2694: Namespace 'NodeJS' has no exported member 'Timeout'.

       node_modules/puppeteer/lib/types.d.ts(6489,71): error TS2583: Cannot find name 'BigInt'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2020' or later.

       node_modules/puppeteer/lib/types.d.ts(6894,28): error TS2694: Namespace 'NodeJS' has no exported member 'Timeout'.

npm ERR! code ELIFECYCLE

npm ERR! errno 2

npm ERR! api@0.0.1 build: `NODE_ENV=production tsc`

npm ERR! Exit status 2

npm ERR! 

npm ERR! Failed at the api@0.0.1 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.LPsTK/_logs/2021-10-13T12_15_23_280Z-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

       

       If you're stuck, please submit a ticket so we can help:

       https://help.heroku.com/

       

       Love,

       Heroku

       

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

 !     Push failed

The problem seems to be missing types, here are two possible fix:问题似乎是缺少类型,这里有两种可能的解决方法:

  1. Install @types/node as a devDependencies .安装@types/node作为devDependencies This package contains types for NodeJS, including the Timeout type.这个包包含 NodeJS 的类型,包括Timeout类型。

  2. Edit your tsconfig.json to set skipLibCheck to true :编辑您的tsconfig.json以将skipLibCheck设置为true

{
  "compilerOptions": {
    "skipLibCheck": true
  }
}

This will ignore type errors in d.ts files (your error come from node_modules/puppeteer/lib/types.d.ts so it should fix it).这将忽略d.ts文件中的类型错误(您的错误来自node_modules/puppeteer/lib/types.d.ts所以它应该修复它)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 模态不适用于heroku; 但在本地工作正常 - modal not working on heroku; but works fine locally Angular 2 / Nodejs部署到heroku错误heroku-postbuild:`ng build` - Angular 2/Nodejs deploy to heroku error heroku-postbuild: `ng build` 套接字IO在本地计算机上运行良好,但在Heroku上不起作用 - Socket IO works fine on local machine but doesn't work on Heroku 在NodeJS中使用Socket.IO可以在本地工作,但不能在Heroku上工作 - Using Socket.IO in NodeJS works local, but not on Heroku 本地 Gatsby 工作得很好,但在构建时使用 graphQL 查询失败 - Local Gatsby works just fine but fails at build time with graphQL query 我在 Heroku 上部署时 sendGrid 不起作用 - sendGrid not working when I deploy on Heroku Javascript部署到Heroku时未执行,但在本地运行良好 - Javascript not executing when deployed to heroku, but works fine locally 无法在heroku上部署gulp应用程序。 Heroku本地网络可以运行 - Can not deploy gulp application on heroku. Heroku local web works though 未从 heroku nodejs 应用程序发送电子邮件(在本地工作正常) - E-mail not sent from heroku nodejs app(works fine locally) 尝试将带有顺风的 MERN 堆栈部署到 Heroku 时构建失败 - Build failed when trying to deploy a MERN stack with tailwind onto Heroku
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM