Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 轨道5+;Angular 2应用程序部署到Heroku-构建“;“成功”;但是部署错误_Ruby On Rails_Angularjs_Heroku_Deployment - Fatal编程技术网

Ruby on rails 轨道5+;Angular 2应用程序部署到Heroku-构建“;“成功”;但是部署错误

Ruby on rails 轨道5+;Angular 2应用程序部署到Heroku-构建“;“成功”;但是部署错误,ruby-on-rails,angularjs,heroku,deployment,Ruby On Rails,Angularjs,Heroku,Deployment,这是我的第一篇SO帖子,所以请对我放松点 我正在尝试部署一个Rails API应用程序,其中Angular 2嵌入在client文件夹中,这样我就可以一次性部署整个应用程序。但是,当使用git push heroku master部署时,尽管应用程序无法部署,但构建“成功” 首先,我将Angular客户端应用程序链接到公用文件夹: $ rm -rf public $ ln -s client/dist public 然后,我添加了以下构建包: $ heroku buildpacks:add h

这是我的第一篇SO帖子,所以请对我放松点

我正在尝试部署一个Rails API应用程序,其中Angular 2嵌入在
client
文件夹中,这样我就可以一次性部署整个应用程序。但是,当使用git push heroku master部署时,尽管应用程序无法部署,但构建“成功”

首先,我将Angular客户端应用程序链接到公用文件夹:

$ rm -rf public
$ ln -s client/dist public
然后,我添加了以下构建包:

$ heroku buildpacks:add https://github.com/jasonswett/heroku-buildpack-nodejs
$ heroku buildpacks:add heroku/ruby
这是我的package.json:

 {
  "name": "my_app",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor",
    "preinstall": "npm install -g node-gyp",
    "heroku-postbuild": "ng build"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "core-js": "^2.4.0",
    "rxjs": "5.0.0-beta.11",
    "ts-helpers": "^1.1.1",
    "zone.js": "0.6.12",
    "@types/jasmine": "^2.2.30",
    "angular-cli": "1.0.0-beta.11-webpack.8",
    "codelyzer": "~0.0.26",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "0.13.22",
    "karma-chrome-launcher": "0.2.3",
    "karma-jasmine": "0.3.8",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.3",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "2.0.0",
    "awesome-typescript-loader": "2.2.1"
  },
  "devDependencies": {
  }
}
按照问题帖子的建议添加
“awesome typescript loader”:“2.2.1”
包中。json
依赖项也没有解决此错误

仅供参考,我一直遵循Jason Swett的主题指南:

git push heroku master之后日志的相关部分:

{...}
re34ms emitting
remote:        Hash: 8b0f868d8f0eb54b494b
remote:        Version: webpack 2.1.0-beta.21
remote:        Time: 10807ms
remote:        Asset       Size  Chunks             Chunk Names
remote:        main.bundle.js    2.51 MB    0, 2  [emitted]  main
remote:        styles.bundle.js    10.2 kB    1, 2  [emitted]  styles
remote:        inline.js    5.53 kB       2  [emitted]  inline
remote:        main.map    3.12 MB    0, 2  [emitted]  main
remote:        styles.map    14.2 kB    1, 2  [emitted]  styles
remote:        inline.map    5.59 kB       2  [emitted]  inline
remote:        index.html  472 bytes          [emitted]
remote:        chunk    {0} main.bundle.js, main.map (main) 2.46 MB {1} [initial] [rendered]
remote:        chunk    {1} styles.bundle.js, styles.map (styles) 9.96 kB {2} [initial] [rendered]
remote:        chunk    {2} inline.js, inline.map (inline) 0 bytes [entry] [rendered]
remote:
remote:        ERROR in [default] /tmp/build_26074be1021be2d930cc2ecb8ff54a9a/client/src/app/app.component.ts:5:12
remote:        Cannot find name 'require'.
remote:
remote:        ERROR in [default] /tmp/build_26074be1021be2d930cc2ecb8ff54a9a/client/src/app/app.component.ts:6:11
remote:        Cannot find name 'require'.
remote:        Child html-webpack-plugin for "index.html":
remote:        Asset     Size  Chunks       Chunk Names
remote:        index.html  2.81 kB       0
remote:        chunk    {0} index.html 339 bytes [entry] [rendered]
{...}
为了调试此问题,是否需要了解任何其他相关信息

"scripts": {
"start": "ng serve --proxy-config proxy.conf.json",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"heroku-postbuild": "ng build --prod"
},  

“开始”:“ng serve——代理配置proxy.conf.json”


在推到heroku之前,不要忘记提交您的更改:)

您需要为typescript定义require才能知道,请参阅“scripts”:{“start”:“ng serve--proxy config proxy.conf.json”,“lint”:“tslint\”src/***/.ts\,“test”:“ng test”,“pree2e”:“webdriver manager update”,“e2e”:“dragotor”,“heroku后期构建”:“ng build--prod”},