Create-react-app推送至Heroku错误“推送被拒绝,无法编译Node.js应用。”

时间:2020-01-26 12:36:29

标签: reactjs heroku create-react-app

我试图将我的create-react-app推送到Heroku,但我一直收到错误消息。我做了一些调整,并听取了不同的建议,但到目前为止都没有奏效。我在用纱。

在我最后一次尝试推送到Heroku时,我得到了:

Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 12 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 4.07 KiB | 695.00 KiB/s, done.
Total 6 (delta 4), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  13.5.0
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  1.21.1
remote:        
remote:        Resolving node version 13.5.0...
remote:        Downloading and installing node 13.5.0...
remote:        Using default npm version: 6.13.4
remote:        Resolving yarn version 1.21.1...
remote:        Downloading and installing yarn (1.21.1)...
remote:        Installed yarn 1.21.1
remote:        
remote: -----> Restoring cache
remote:        - node_modules
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v1.21.1
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        warning sha.js@2.4.11: Invalid bin entry for "sha.js" (in "sha.js").
remote:        info fsevents@2.1.2: The platform "linux" is incompatible with this module.
remote:        info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        info fsevents@1.2.11: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation
remote:        [3/4] Linking dependencies...
remote:        warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5".
remote:        warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
remote:        warning " > webpack-cli@3.3.10" has unmet peer dependency "webpack@4.x.x".
remote:        [4/4] Building fresh packages...
remote:        Done in 55.02s.
remote:        
remote: -----> Build
remote:        Detected both "build" and "heroku-postbuild" scripts
remote:        Running heroku-postbuild (yarn)
remote:        yarn run v1.21.1
remote:        $ webpack --config webpack.config.prod.js
remote: /tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/cli.js:93
remote:                 throw err;
remote:                 ^
remote: 
remote: Error: Cannot find module '/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/webpack.config.prod.js'
remote: Require stack:
remote: - /tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/utils/convert-argv.js
remote: - /tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/cli.js
remote: - /tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack/bin/webpack.js
remote:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:17)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:859:27)
remote:     at Module.require (internal/modules/cjs/loader.js:1028:19)
remote:     at require (/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
remote:     at WEBPACK_OPTIONS (/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13)
remote:     at requireConfig (/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6)
remote:     at /tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
remote:     at Array.forEach (<anonymous>)
remote:     at module.exports (/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)
remote:     at /tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/cli.js:71:45
remote:     at Object.parse (/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18)
remote:     at /tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/cli.js:49:8
remote:     at Object.<anonymous> (/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/cli.js:366:3)
remote:     at Module._compile (internal/modules/cjs/loader.js:1139:30)
remote:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
remote:     at Module.load (internal/modules/cjs/loader.js:988:32)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:896:14)
remote:     at Module.require (internal/modules/cjs/loader.js:1028:19)
remote:     at require (internal/modules/cjs/helpers.js:72:18)
remote:     at Object.<anonymous> (/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack/bin/webpack.js:156:2)
remote:     at Module._compile (internal/modules/cjs/loader.js:1139:30)
remote:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
remote:     at Module.load (internal/modules/cjs/loader.js:988:32)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:896:14)
remote:     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
remote:     at internal/main/run_main_module.js:17:47 {
remote:   code: 'MODULE_NOT_FOUND',
remote:   requireStack: [
remote:     '/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/utils/convert-argv.js',
remote:     '/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack-cli/bin/cli.js',
remote:     '/tmp/build_d324d0fbfcb8e2213a839cbc6832e594/node_modules/webpack/bin/webpack.js'
remote:   ]
remote: }
remote: error Command failed with exit code 1.
remote:        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
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:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to glacial-beach-35568.
remote: 
To https://git.heroku.com/glacial-beach-35568.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/glacial-beach-35568.git

我一直在对package.json文件进行更改,因为我遵循了StackOverflow和其他网站的不同建议。我的package.json文件当前为:

{
  "name": "tom-hill-tech",
  "version": "0.1.0",
  "private": true,
  "homepage": "http://tomhill991.github.io/tom-hill-tech",
  "engines": {
    "yarn": "1.21.1",
    "node": "13.5.0"
  },
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "gh-pages": "^2.2.0",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-mdl": "^2.0.2",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.3.0",
    "serve": "^11.3.0"
  },
  "scripts": {
    "start": "webpack-dev-server",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "heroku-postbuild": "webpack --config webpack.config.prod.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"
    ]
  },
  "devDependencies": {
    "babel-plugin-transform-class-properties": "^6.24.1",
    "webpack-cli": "^3.3.10"
  }
}

有人有什么建议吗?

谢谢

0 个答案:

没有答案