最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

为什么Heroku的建立与更简洁失败

IT培训 admin 5浏览 0评论

为什么Heroku的建立与更简洁失败

我完全新的Heroku和布拉德Tersey的Udemy类的视频设置了我的Heroku帐户的步骤。我也已经建立了类... Heroku的构建过程中工作了一段时间后,Heroku的部署......但现在它似乎被打破,我有一个很难弄清楚为什么。

我也应该注意到这工作我家里的电脑罚款...我可以NPM安装并运行NPM Dev和一切加载和运行。

首先,我跑这个命令:

heroku git:remote -a guarded-brook-39446

然后,我跑到下面的命令:

git push heroku master

这是生成日志:

    D:\Code\Udemy\MERN\MERN>git push heroku master
    Enumerating objects: 809, done.
    Counting objects: 100% (809/809), done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (685/685), done.
    Writing objects: 100% (765/765), 165.50 KiB | 1.38 MiB/s, done.
    Total 765 (delta 566), reused 102 (delta 79)
    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=false
    remote:        NODE_VERBOSE=false
    remote:
    remote: -----> Installing binaries
    remote:        engines.node (package.json):  8.11.4
    remote:        engines.npm (package.json):   5.6.0
    remote:
    remote:        Resolving node version 8.11.4...
    remote:        Downloading and installing node 8.11.4...
    remote:        npm 5.6.0 already installed with node
    remote:
    remote: -----> Restoring cache
    remote:        Caching has been disabled because NODE_MODULES_CACHE=false
    remote:
    remote: -----> Building dependencies
    remote:        Installing node modules (package.json + package-lock)
    remote:
    remote:        > [email protected] postinstall /tmp/build_f19e608b09c6e8b101acf02b50e8189b/node_modules/nodemon
    remote:        > node bin/postinstall || exit 0
    remote:
    remote:        Love nodemon? You can now support the project via the open collective:
    remote:         > 
    remote:
    remote:        added 372 packages in 10.391s
    remote:        Running heroku-postbuild
    remote:
    remote:        > [email protected] heroku-postbuild /tmp/build_f19e608b09c6e8b101acf02b50e8189b
    remote:        > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
    remote:
    remote:        added 1941 packages in 41.504s
    remote:
    remote:        > [email protected] build /tmp/build_f19e608b09c6e8b101acf02b50e8189b/client
    remote:        > react-scripts build
    remote:
    remote:        Creating an optimized production build...
    remote:        Failed to compile.
    remote:
    remote:        Failed to minify the bundle. Error: static/js/main.9856cdb3.chunk.js from Terser
    remote:        TypeError: Cannot read property 'minify' of undefined
    remote:            at compiler.run (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/react-scripts/scripts/build.js:169:23)
    remote:            at finalCallback (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:210:39)
    remote:            at hooks.done.callAsync.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:226:13)
    remote:            at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    remote:            at AsyncSeriesHook.lazyCompileHook (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/Hook.js:154:20)
    remote:            at onCompiled (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:224:21)
    remote:            at hooks.afterCompile.callAsync.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:553:14)
    remote:            at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    remote:            at AsyncSeriesHook.lazyCompileHook (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/Hook.js:154:20)
    remote:            at compilation.seal.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:550:30)
    remote:            at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    remote:            at AsyncSeriesHook.lazyCompileHook (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/Hook.js:154:20)
    remote:            at hooks.optimizeAssets.callAsync.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compilation.js:1295:35)
    remote:            at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    remote:            at AsyncSeriesHook.lazyCompileHook (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/Hook.js:154:20)
    remote:            at hooks.optimizeChunkAssets.callAsync.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compilation.js:1286:32)
    remote:        Read more here: http: // bit.ly / CRA-build-minify
    remote:
    remote: npm ERR! code ELIFECYCLE
    remote: npm ERR! errno 1
    remote: npm ERR! [email protected] build: `react-scripts build`
    remote: npm ERR! Exit status 1
    remote: npm ERR!
    remote: npm ERR! Failed at the [email protected] 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.dkOHV/_logs/2019-02-10T01_09_07_572Z-debug.log
    remote: npm ERR! code ELIFECYCLE
    remote: npm ERR! errno 1
    remote: npm ERR! [email protected] heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm
    run build --prefix client`
    remote: npm ERR! Exit status 1
    remote: npm ERR!
    remote: npm ERR! Failed at the [email protected] heroku-postbuild 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.dkOHV/_logs/2019-02-10T01_09_07_587Z-debug.log
    remote:
    remote: -----> Build failed
    remote:
    remote:        We're sorry this build is failing! You can troubleshoot common issues here:
    remote:        
    remote:
    remote:        If you're stuck, please submit a ticket so we can help:
    remote:        /
    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 guarded-brook-39446.
    remote:
    To .git
    ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to '.git'

我的项目包括服务器和客户端的。

这里是服务器的package.json文件:

{
  "name": "mern",
  "version": "1.0.0",
  "description": "social network for developers",
  "main": "server.js",
  "engines": {
    "node": "8.11.4",
    "npm": "5.6.0"
  },
  "scripts": {
    "client-install": "npm install --prefix client",
    "start": "node server.js",
    "server": "nodemon server.js",
    "client": "npm start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\"",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
  },
  "author": "Me",
  "license": "MIT",
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.18.2",
    "concurrently": "^4.1.0",
    "dotenv": "^6.2.0",
    "express": "^4.16.3",
    "gravatar-url": "^2.0.0",
    "jsonwebtoken": "^8.2.0",
    "mongoose": "^5.0.12",
    "nodemailer": "^4.7.0",
    "passport": "^0.4.0",
    "passport-jwt": "^4.0.0",
    "randomstring": "^1.1.5",
    "validator": "^9.4.1"
  },
  "devDependencies": {
    "nodemon": "^1.18.6"
  }
}

这里是我的客户的package.json文件:

    {
      "name": "client",
      "version": "0.1.0",
      "private": true,
      "engines": {
        "node": "8.11.4",
        "npm": "5.6.0"
      },
      "dependencies": {
        "axios": "^0.18.0",
        "classnames": "^2.2.5",
        "jsonwebtoken": "^8.4.0",
        "moment": "^2.22.0",
        "react": "^16.3.1",
        "react-dom": "^16.3.1",
        "react-image-mapper": "0.0.9",
        "react-moment": "^0.8.4",
        "react-redux": "^5.0.7",
        "react-router-dom": "^4.2.2",
        "react-scripts": "^2.1.1",
        "reactstrap": "^7.1.0",
        "redux": "^3.7.2",
        "redux-thunk": "^2.2.0"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
      "proxy": "http://localhost:5000",
      "eslintConfig": {
        "extends": "react-app"
      },
      "browserslist": [
        ">0.2%",
        "not dead",
        "not ie <= 11",
        "not op_mini all"
      ]
    }
回答如下:

所以我做了互联网的一些冲刷,发现这篇文章:

https://github/facebook/create-react-app/issues/6334其中erwanriou做了如下评论:

ok i fix how to do it. We have to change the script just for this case:
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm install [email protected] --prefix client && npm run build --prefix client"

所以我改变了我的Heroku,postbuild他的提议。它内置!

感谢erwanriou

为什么Heroku的建立与更简洁失败

我完全新的Heroku和布拉德Tersey的Udemy类的视频设置了我的Heroku帐户的步骤。我也已经建立了类... Heroku的构建过程中工作了一段时间后,Heroku的部署......但现在它似乎被打破,我有一个很难弄清楚为什么。

我也应该注意到这工作我家里的电脑罚款...我可以NPM安装并运行NPM Dev和一切加载和运行。

首先,我跑这个命令:

heroku git:remote -a guarded-brook-39446

然后,我跑到下面的命令:

git push heroku master

这是生成日志:

    D:\Code\Udemy\MERN\MERN>git push heroku master
    Enumerating objects: 809, done.
    Counting objects: 100% (809/809), done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (685/685), done.
    Writing objects: 100% (765/765), 165.50 KiB | 1.38 MiB/s, done.
    Total 765 (delta 566), reused 102 (delta 79)
    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=false
    remote:        NODE_VERBOSE=false
    remote:
    remote: -----> Installing binaries
    remote:        engines.node (package.json):  8.11.4
    remote:        engines.npm (package.json):   5.6.0
    remote:
    remote:        Resolving node version 8.11.4...
    remote:        Downloading and installing node 8.11.4...
    remote:        npm 5.6.0 already installed with node
    remote:
    remote: -----> Restoring cache
    remote:        Caching has been disabled because NODE_MODULES_CACHE=false
    remote:
    remote: -----> Building dependencies
    remote:        Installing node modules (package.json + package-lock)
    remote:
    remote:        > [email protected] postinstall /tmp/build_f19e608b09c6e8b101acf02b50e8189b/node_modules/nodemon
    remote:        > node bin/postinstall || exit 0
    remote:
    remote:        Love nodemon? You can now support the project via the open collective:
    remote:         > 
    remote:
    remote:        added 372 packages in 10.391s
    remote:        Running heroku-postbuild
    remote:
    remote:        > [email protected] heroku-postbuild /tmp/build_f19e608b09c6e8b101acf02b50e8189b
    remote:        > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
    remote:
    remote:        added 1941 packages in 41.504s
    remote:
    remote:        > [email protected] build /tmp/build_f19e608b09c6e8b101acf02b50e8189b/client
    remote:        > react-scripts build
    remote:
    remote:        Creating an optimized production build...
    remote:        Failed to compile.
    remote:
    remote:        Failed to minify the bundle. Error: static/js/main.9856cdb3.chunk.js from Terser
    remote:        TypeError: Cannot read property 'minify' of undefined
    remote:            at compiler.run (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/react-scripts/scripts/build.js:169:23)
    remote:            at finalCallback (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:210:39)
    remote:            at hooks.done.callAsync.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:226:13)
    remote:            at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    remote:            at AsyncSeriesHook.lazyCompileHook (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/Hook.js:154:20)
    remote:            at onCompiled (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:224:21)
    remote:            at hooks.afterCompile.callAsync.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:553:14)
    remote:            at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    remote:            at AsyncSeriesHook.lazyCompileHook (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/Hook.js:154:20)
    remote:            at compilation.seal.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compiler.js:550:30)
    remote:            at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    remote:            at AsyncSeriesHook.lazyCompileHook (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/Hook.js:154:20)
    remote:            at hooks.optimizeAssets.callAsync.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compilation.js:1295:35)
    remote:            at AsyncSeriesHook.eval [as callAsync] (eval at create (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    remote:            at AsyncSeriesHook.lazyCompileHook (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/tapable/lib/Hook.js:154:20)
    remote:            at hooks.optimizeChunkAssets.callAsync.err (/tmp/build_f19e608b09c6e8b101acf02b50e8189b/client/node_modules/webpack/lib/Compilation.js:1286:32)
    remote:        Read more here: http: // bit.ly / CRA-build-minify
    remote:
    remote: npm ERR! code ELIFECYCLE
    remote: npm ERR! errno 1
    remote: npm ERR! [email protected] build: `react-scripts build`
    remote: npm ERR! Exit status 1
    remote: npm ERR!
    remote: npm ERR! Failed at the [email protected] 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.dkOHV/_logs/2019-02-10T01_09_07_572Z-debug.log
    remote: npm ERR! code ELIFECYCLE
    remote: npm ERR! errno 1
    remote: npm ERR! [email protected] heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm
    run build --prefix client`
    remote: npm ERR! Exit status 1
    remote: npm ERR!
    remote: npm ERR! Failed at the [email protected] heroku-postbuild 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.dkOHV/_logs/2019-02-10T01_09_07_587Z-debug.log
    remote:
    remote: -----> Build failed
    remote:
    remote:        We're sorry this build is failing! You can troubleshoot common issues here:
    remote:        
    remote:
    remote:        If you're stuck, please submit a ticket so we can help:
    remote:        /
    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 guarded-brook-39446.
    remote:
    To .git
    ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to '.git'

我的项目包括服务器和客户端的。

这里是服务器的package.json文件:

{
  "name": "mern",
  "version": "1.0.0",
  "description": "social network for developers",
  "main": "server.js",
  "engines": {
    "node": "8.11.4",
    "npm": "5.6.0"
  },
  "scripts": {
    "client-install": "npm install --prefix client",
    "start": "node server.js",
    "server": "nodemon server.js",
    "client": "npm start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\"",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
  },
  "author": "Me",
  "license": "MIT",
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.18.2",
    "concurrently": "^4.1.0",
    "dotenv": "^6.2.0",
    "express": "^4.16.3",
    "gravatar-url": "^2.0.0",
    "jsonwebtoken": "^8.2.0",
    "mongoose": "^5.0.12",
    "nodemailer": "^4.7.0",
    "passport": "^0.4.0",
    "passport-jwt": "^4.0.0",
    "randomstring": "^1.1.5",
    "validator": "^9.4.1"
  },
  "devDependencies": {
    "nodemon": "^1.18.6"
  }
}

这里是我的客户的package.json文件:

    {
      "name": "client",
      "version": "0.1.0",
      "private": true,
      "engines": {
        "node": "8.11.4",
        "npm": "5.6.0"
      },
      "dependencies": {
        "axios": "^0.18.0",
        "classnames": "^2.2.5",
        "jsonwebtoken": "^8.4.0",
        "moment": "^2.22.0",
        "react": "^16.3.1",
        "react-dom": "^16.3.1",
        "react-image-mapper": "0.0.9",
        "react-moment": "^0.8.4",
        "react-redux": "^5.0.7",
        "react-router-dom": "^4.2.2",
        "react-scripts": "^2.1.1",
        "reactstrap": "^7.1.0",
        "redux": "^3.7.2",
        "redux-thunk": "^2.2.0"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
      "proxy": "http://localhost:5000",
      "eslintConfig": {
        "extends": "react-app"
      },
      "browserslist": [
        ">0.2%",
        "not dead",
        "not ie <= 11",
        "not op_mini all"
      ]
    }
回答如下:

所以我做了互联网的一些冲刷,发现这篇文章:

https://github/facebook/create-react-app/issues/6334其中erwanriou做了如下评论:

ok i fix how to do it. We have to change the script just for this case:
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm install [email protected] --prefix client && npm run build --prefix client"

所以我改变了我的Heroku,postbuild他的提议。它内置!

感谢erwanriou

发布评论

评论列表 (0)

  1. 暂无评论