Heroku部署失败但本地构建和编译成功

时间:2017-02-04 21:09:19

标签: angularjs node.js heroku bower

使用node,bower和gulp的Angular app。

问题 尝试登录Heroku时:TypeError:w不是函数

当地环境的初步建设很好。 Gulp构建并能够登录。 Gulp编译并能够在本地IIS上登录。部署到Heroku并获得上述错误。即使在返回Heroku上的最后一次已知良好提交后,也无法在本地复制。

删除项目的本地版本并重建。现在可以在本地环境中复制错误。在SO相同的角度资源方法和相同的角度资源版本上找到解决方案。 Angular是版本1.5.9,角度资源是1.6.1。使用角度资源重建为1.5.9并且一切都很好。我现在可以在本地无错误地登录:构建并编译到本地IIS而不会出错。

更新了bower.json:

{
  "name": "Removed",
  "authors": [
    "Removed"
  ],
  "description": "Removed",
  "main": "index",
  "moduleType": [],
  "keywords": [
    "Removed"
  ],
  "license": "MIT",
  "homepage": "https://Removed",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "bootstrap": "^3.3.6",
    "angular": "1.5.9",
    "angular-animate": "1.5.9",
    "angular-resource": "1.5.9",
    "angular-sanitize": "1.5.9",
    "angular-touch": "1.5.9",
    "angular-messages": "1.5.9",
    "angular-toastr": "^1.7.0",
    "angular-ui-tree": "^2.16.0",
    "angular-bootstrap": "^1.3.3",
    "angular-auto-validate": "^1.19.5",
    "font-awesome": "^4.6.3",
    "angular-snap": "^1.8.5",
    "angular-localforage": "^1.2.5",
    "underscore": "^1.8.3",
    "angular-ui-router": "^0.3.1",
    "angular-busy": "^4.1.3",
    "aws-sdk": "aws-sdk-js#^2.6.11",
    "ng-csv": "^0.3.6",
    "angular-file-saver": "^1.1.2"
  },
  "devDependencies": {
    "angular-mocks": "1.5.9"
  },
  "resolutions": {
    "angular": "1.5.9",
    "angular-animate": "1.5.9",
    "angular-resource": "1.5.9"
  }
}

和package.json:

{
  "name": "Removed",
  "version": "1.0.0",
  "description": "Removed",
  "main": "app.js",
  "engines": {
    "node": "5.6.0",
    "npm": "3.6.0"
  },
  "cacheDirectories": [
    "node_modules",
    "bower_components"
  ],
  "scripts": {
    "postinstall": "bower cache clean && bower install && npm run build-all",
    "start": "node server.js",
    "build-all": "gulp inject index",
    "test": "gulp test:unit",
    "test-e2e": "gulp test:e2e"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/Removed"
  },
  "keywords": [
    "Removed"
  ],
  "author": "Removed",
  "license": "MIT",
  "bugs": {
    "url": "https://Removed/"
  },
  "homepage": "https://Removed/",
  "dependencies": {
    "bower": "1.7.7",
    "browser-sync": "^2.11.1",
    "del": "^2.2.0",
    "express": "^4.13.4",
    "fs": "0.0.2",
    "gulp": "^3.9.0",
    "gulp-angular-filesort": "^1.1.1",
    "gulp-angular-templatecache": "^1.8.0",
    "gulp-autoprefixer": "^3.1.0",
    "gulp-beautify": "^2.0.0",
    "gulp-cached": "^1.1.0",
    "gulp-concat": "^2.6.0",
    "gulp-csso": "^1.0.1",
    "gulp-filter": "^3.0.1",
    "gulp-flatten": "^0.2.0",
    "gulp-htmlmin": "^1.3.0",
    "gulp-imagemin": "^2.4.0",
    "gulp-inject": "^3.0.0",
    "gulp-less": "^3.0.5",
    "gulp-less-import": "^1.0.0",
    "gulp-ng-annotate": "^1.1.0",
    "gulp-ng-constant": "^1.1.0",
    "gulp-nodemon": "^2.0.6",
    "gulp-open": "^1.0.0",
    "gulp-protractor": "^2.1.0",
    "gulp-rev": "^6.0.1",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-uglify": "^1.5.1",
    "gulp-wrapper": "^1.0.0",
    "jasmine": "^2.4.1",
    "jasmine-node": "^1.14.5",
    "main-bower-files": "^2.11.1",
    "plato": "^1.5.0",
    "protractor": "^3.1.1",
    "require-dir": "^0.3.0",
    "selenium-standalone": "^4.9.1",
    "selenium-webdriver": "^2.52.0",
    "yargs": "^3.32.0"
  },
  "devDependencies": {}
}

即使缓存清理,依赖项匹配,问题仍然存在于Heroku上。构建日志很干净,并且读取没有问题。 我对Heroku的工作缺少什么?

带有次要项目的Heroku日志编辑

-----> Node.js app detected
-----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NPM_CONFIG_PRODUCTION=true
   NODE_VERBOSE=false
   NODE_ENV=production
   NODE_MODULES_CACHE=true
-----> Installing binaries
   engines.node (package.json):  5.6.0
   engines.npm (package.json):   3.6.0

   Downloading and installing node 5.6.0...
   npm 3.6.0 already installed with node
-----> Restoring cache
   Loading 2 from cacheDirectories (package.json):
   - node_modules
   - bower_components
-----> Building dependencies
   Installing node modules (package.json)

   > **removed**-seed@1.0.0 postinstall /tmp/build_f9f5334ca3b4f65239fd45fcbf9493ea/**removed**-959eff2
   > bower cache clean && bower install && npm run build-all


   > **removed**-seed@1.0.0 build-all /tmp/build_f9f5334ca3b4f65239fd45fcbf9493ea/**removed**-959eff2
   > gulp inject index

   [18:43:00] Using gulpfile /tmp/build_f9f5334ca3b4f65239fd45fcbf9493ea/**removed**/gulpfile.js
   [18:43:00] Starting 'clean:inject'...
   [18:43:00] Starting 'clean:scripts'...
   [18:43:00] Starting 'clean:assets'...
   [18:43:00] Starting 'clean:app-config'...
   [18:43:00] Starting 'clean:bower-fonts'...
   [18:43:00] Starting 'clean:styles'...
   [18:43:00] Starting 'clean-index'...
   [18:43:00] Starting 'clean:app-js'...
   [18:43:00] Starting 'clean:lib-js'...
   [18:43:00] Starting 'clean:app-css'...
   [18:43:00] Starting 'clean:fonts'...
   [18:43:00] Starting 'clean:images'...
   [18:43:00] Finished 'clean:inject' after 24 ms
   [18:43:00] Finished 'clean:scripts' after 18 ms
   [18:43:00] Starting 'scripts'...
   [18:43:00] Finished 'clean:app-config' after 50 ms
   [18:43:00] Starting 'app-config'...
   [18:43:01] Finished 'clean:styles' after 55 ms
   [18:43:01] Starting 'styles'...
   [18:43:01] Finished 'clean:assets' after 109 ms
   [18:43:01] Starting 'assets'...
   [18:43:01] Finished 'clean:bower-fonts' after 111 ms
   [18:43:01] Starting 'bower-fonts'...
   [18:43:01] Finished 'clean-index' after 115 ms
   [18:43:01] Finished 'clean:app-css' after 112 ms
   [18:43:01] Starting 'app-css'...
   [18:43:01] Finished 'clean:app-js' after 155 ms
   [18:43:01] Starting 'app-js'...
   [18:43:01] Finished 'clean:lib-js' after 171 ms
   [18:43:01] Starting 'lib-js'...
   [18:43:01] Finished 'clean:fonts' after 211 ms
   [18:43:01] Starting 'fonts'...
   [18:43:01] Finished 'clean:images' after 215 ms
   [18:43:01] Starting 'images'...
   [18:43:11] Finished 'app-config' after 11 s
   [18:43:19] gulp-imagemin: Minified 14 images (saved 44.42 kB - 5.5%)
   [18:43:33] Finished 'bower-fonts' after 33 s
   [18:43:35] Finished 'lib-js' after 35 s
   [18:43:35] Finished 'assets' after 35 s
   [18:43:35] Finished 'images' after 35 s
   [18:43:36] Finished 'fonts' after 35 s
   [18:43:39] Finished 'styles' after 38 s
   [18:43:42] Finished 'app-css' after 42 s
   [18:43:42] Finished 'scripts' after 42 s
   [18:43:42] Starting 'inject'...
   [18:43:42] gulp-inject 30 files into index.html.
   [18:43:42] gulp-inject 49 files into index.html.
   [18:43:42] Finished 'inject' after 213 ms
   [18:43:46] Finished 'app-js' after 46 s
   [18:43:46] Starting 'index'...
   [18:43:46] gulp-inject 1 files into index.html.
   [18:43:46] gulp-inject 2 files into index.html.
   [18:43:46] Finished 'index' after 27 ms
-----> Caching build
   Clearing previous node cache
   Saving 2 cacheDirectories (package.json):
   - node_modules
   - bower_components
-----> Build succeeded!
-----> Discovering process types
   Procfile declares types     -> (none)
   Default types for buildpack -> web
-----> Compressing...
   Done: 53M
-----> Launching...
   Released v89
   **removed** deployed to Heroku

1 个答案:

答案 0 :(得分:0)

问题是由于包依赖性造成的。 bower.json文件已更新。

Angular设置为^ 1.6.1,其他角度包设置为^ 1.5.9