node.js - Heroku 构建被拒绝 - NodeJS

标签 node.js heroku github build

我正在努力在 Heroku 上成功执行 NodeJS 应用程序的构建。该应用程序在本地运行,当我将它推送到 Heroku 时,它运行得很好。但随后的推送都被 Heroku 拒绝了。这是我得到的:

    Counting objects: 15, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (15/15), 1.34 KiB | 0 bytes/s, done.
Total 15 (delta 7), 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:        NPM_CONFIG_PRODUCTION=true
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote: 
remote: -----> Installing binaries
remote:        engines.node (package.json):  7.10.0
remote:        engines.npm (package.json):   5.3.0
remote:        
remote:        Resolving node version 7.10.0...
remote:        Downloading and installing node 7.10.0...
remote:        Bootstrapping npm 5.3.0 (replacing 4.2.0)...
remote:        npm 5.3.0 installed
remote: 
remote: -----> Restoring cache
remote:        Loading 2 from cacheDirectories (default):
remote:        - node_modules
remote:        - bower_components (not cached - skipping)
remote: 
remote: -----> Building dependencies
remote:        Installing node modules (package.json)
remote:        npm ERR! Cannot read property '0' of undefined
remote:        
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /app/.npm/_logs/2017-07-28T16_01_18_490Z-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:        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

我真的不明白无法读取未定义的属性'0'意味着什么。

编辑:这是package.json(在本地不会给我带来任何问题)

{
  "name": "truffle-init-webpack",
  "description": "Frontend example using truffle v3",
  "scripts": {
    "lint": "eslint ./",
    "build": "webpack",
    "dev": "webpack-dev-server"
  },
  "engines": {
    "node": "7.10.0",
    "npm": "5.3.0"
  },
  "author": "Douglas von Kohorn",
  "license": "MIT",
  "dependencies": {
    "babel-cli": "^6.22.2",
    "babel-core": "^6.22.1",
    "babel-eslint": "^6.1.2",
    "babel-loader": "^6.2.10",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-preset-env": "^1.1.8",
    "babel-preset-es2015": "^6.22.0",
    "babel-register": "^6.22.0",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.26.1",
    "eslint": "^3.14.0",
    "eslint-config-standard": "^6.0.0",
    "eslint-plugin-babel": "^4.0.0",
    "eslint-plugin-mocha": "^4.8.0",
    "eslint-plugin-promise": "^3.0.0",
    "eslint-plugin-standard": "^2.0.0",
    "html-webpack-plugin": "^2.28.0",
    "json-loader": "^0.5.4",
    "style-loader": "^0.13.1",
    "truffle-contract": "^1.1.6",
    "web3": "^0.18.2",
    "webpack": "^2.2.1",
    "webpack-dev-server": "^2.3.0"
  }
}

最佳答案

错误似乎出现在您的 package.json 中。 请参阅以下链接。

Cannot read property '0' of undefined

看来 NPM@5.3.0 已损坏,请尝试降级到 5.2

关于node.js - Heroku 构建被拒绝 - NodeJS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45377955/

相关文章:

node.js - Node.js 是否会增加跨连接共享数据的风险?

node.js:获取字符串 "あいうえお"的字节长度

ruby-on-rails - 如何使我的网络应用程序更加强大,以应对意外的流量峰值?

java - Maven/Eclipse : add tomcat support to imported project

c++ - “变量”声明为 'inline' 字段

github - 从 github 存储库更新我的网站

node.js - 找出我的nodejs线程卡在哪里?

javascript - Mongoose:向现有对象添加更多项目

ruby-on-rails - Spotify 回调 URI 错误

java - 有没有一种方法可以在一个heroku应用程序中部署两个容器?