Ruby on rails 使用Heroku部署Angular/Rails应用程序

Ruby on rails 使用Heroku部署Angular/Rails应用程序,ruby-on-rails,angularjs,ruby,heroku,Ruby On Rails,Angularjs,Ruby,Heroku,我正在尝试部署angular/rails应用程序,但构建失败。以下是我迄今为止所采取的步骤,使用ruby 2.3.0,rails 5,NodeV6.3.0,npm 3.10.3和psql(PostgreSQL)9.3.13: $ rails new author_wizard --api -T -d postgresql $ rails db:create 然后,添加了角度cli: $ npm install -g angular-cli 从rails项目的根目录: $ ng new aut

我正在尝试部署angular/rails应用程序,但构建失败。以下是我迄今为止所采取的步骤,使用
ruby 2.3.0
rails 5
NodeV6.3.0
npm 3.10.3
psql(PostgreSQL)9.3.13

$ rails new author_wizard --api -T -d postgresql
$ rails db:create
然后,添加了角度cli:

$ npm install -g angular-cli
从rails项目的根目录:

$ ng new author-wizard
$ mv author-wizard client
$ cd client
$ ng server
现在,导航到,我得到一个页面,上面写着“应用程序工作!”

正在设置以部署到Heroku

我从rails应用程序的根目录运行以下命令来创建符号链接:

$ rm -rf public
$ ln -s client/dist public
那么

在推到Heroku之前,我对
client/package.json

“postinstall”:“键入安装和生成(&N)”

然后,我将devdependency移到了dependency,这样Heroku就可以提取它们了

这是我的package.json文件:

{
  "name": "author-wizard",
  "description": "a cool app",
  "version": "0.0.0",
  "engines": {
    "node": "6.3.0",
    "npm": "3.10.3"
  },
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "postinstall": "typings install  && ng build",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.2",
    "es6-shim": "0.35.1",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.26",
    "zone.js": "0.6.12",
    "angular-cli": "1.0.0-beta.10",
    "codelyzer": "0.0.20",
    "ember-cli-inject-live-reload": "1.4.0",
    "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",
    "protractor": "3.3.0",
    "ts-node": "0.5.5",
    "tslint": "3.11.0",
    "typescript": "1.8.10",
    "typings": "1.3.1"
  },
  "devDependencies": {
  }
}
当我推到heroku时,我得到以下错误:

$ git push heroku master

Counting objects: 103, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (87/87), done.
Writing objects: 100% (103/103), 27.47 KiB | 0 bytes/s, done.
Total 103 (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:        NPM_CONFIG_PRODUCTION=true
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote: 
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version (latest stable) via semver.io...
remote:        Downloading and installing node 5.11.1...
remote:        Using default npm version: 3.8.6
remote: 
remote: -----> Restoring cache
remote:        Skipping cache restore (new runtime signature)
remote: 
remote: -----> Building dependencies
remote:        Pruning any extraneous modules
remote:        Installing node modules (package.json)
remote:        
remote:        > author-wizard@0.0.0 postinstall /tmp/build_62d8b6dd78169ce94281eaec1000a797/client
remote:        > typings install  && ng build
remote:        
remote:        
remote:        └── es6-shim (global)
remote:        
remote:        Could not start watchman; falling back to NodeWatcher for file system events.
remote:        Visit http://ember-cli.com/user-guide/#watchman for more info.
remote:        Build failed.
remote:        The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
remote:        Error: Typescript found the following errors:
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (6, 1): Cannot find name 'describe'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (7, 3): Cannot find name 'beforeEach'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (11, 3): Cannot find name 'it'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (13, 7): Cannot find name 'expect'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (16, 3): Cannot find name 'it'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (18, 7): Cannot find name 'expect'.
remote:        at BroccoliTypeScriptCompiler._doIncrementalBuild (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:120:19)
remote:        at BroccoliTypeScriptCompiler.build (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:43:10)
remote:        at /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21
remote:        at lib$rsvp$$internal$$tryCatch (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
remote:        at lib$rsvp$$internal$$invokeCallback (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
remote:        at lib$rsvp$$internal$$publish (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1019:11)
remote:        at lib$rsvp$asap$$flush (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
remote:        at _combinedTickCallback (internal/process/next_tick.js:67:7)
remote:        at process._tickCallback (internal/process/next_tick.js:98:9)
remote:        
remote:        The broccoli plugin was instantiated at:
remote:        at BroccoliTypeScriptCompiler.Plugin (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/broccoli-plugin/index.js:10:31)
remote:        at BroccoliTypeScriptCompiler.CachingWriter [as constructor] (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
remote:        at BroccoliTypeScriptCompiler (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:26:49)
remote:        at Angular2App._getTsTree (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/angular2-app.js:331:18)
remote:        at Angular2App._buildTree (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/angular2-app.js:124:23)
remote:        at new Angular2App (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
remote:        at module.exports (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/angular-cli-build.js:10:10)
remote:        at Class.module.exports.Task.extend.setupBroccoliBuilder (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
remote:        at Class.module.exports.Task.extend.init (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
remote:        at new Class (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
remote:        at Class.module.exports.Task.extend.run (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
remote:        at /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24
remote:        at lib$rsvp$$internal$$tryCatch (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
remote:        at lib$rsvp$$internal$$invokeCallback (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
remote:        at /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
remote:        at lib$rsvp$asap$$flush (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
remote:        
remote:        
remote:        
remote:        
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:        Some possible problems:
remote:        
remote:        - Node version not specified in package.json
remote:        https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 damp-spire-94406.
remote: 
To https://git.heroku.com/damp-spire-94406.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/damp-spire-94406.git'
期望的结果应该与导航到localhost:4200“appworks!”相同

欢迎任何帮助。多谢各位

$ git push heroku master

Counting objects: 103, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (87/87), done.
Writing objects: 100% (103/103), 27.47 KiB | 0 bytes/s, done.
Total 103 (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:        NPM_CONFIG_PRODUCTION=true
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote: 
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version (latest stable) via semver.io...
remote:        Downloading and installing node 5.11.1...
remote:        Using default npm version: 3.8.6
remote: 
remote: -----> Restoring cache
remote:        Skipping cache restore (new runtime signature)
remote: 
remote: -----> Building dependencies
remote:        Pruning any extraneous modules
remote:        Installing node modules (package.json)
remote:        
remote:        > author-wizard@0.0.0 postinstall /tmp/build_62d8b6dd78169ce94281eaec1000a797/client
remote:        > typings install  && ng build
remote:        
remote:        
remote:        └── es6-shim (global)
remote:        
remote:        Could not start watchman; falling back to NodeWatcher for file system events.
remote:        Visit http://ember-cli.com/user-guide/#watchman for more info.
remote:        Build failed.
remote:        The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
remote:        Error: Typescript found the following errors:
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (6, 1): Cannot find name 'describe'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (7, 3): Cannot find name 'beforeEach'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (11, 3): Cannot find name 'it'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (13, 7): Cannot find name 'expect'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (16, 3): Cannot find name 'it'.
remote:        /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/tmp/broccoli_type_script_compiler-input_base_path-D0TFBXoL.tmp/0/src/app/app.component.spec.ts (18, 7): Cannot find name 'expect'.
remote:        at BroccoliTypeScriptCompiler._doIncrementalBuild (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:120:19)
remote:        at BroccoliTypeScriptCompiler.build (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:43:10)
remote:        at /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:152:21
remote:        at lib$rsvp$$internal$$tryCatch (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
remote:        at lib$rsvp$$internal$$invokeCallback (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
remote:        at lib$rsvp$$internal$$publish (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1019:11)
remote:        at lib$rsvp$asap$$flush (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
remote:        at _combinedTickCallback (internal/process/next_tick.js:67:7)
remote:        at process._tickCallback (internal/process/next_tick.js:98:9)
remote:        
remote:        The broccoli plugin was instantiated at:
remote:        at BroccoliTypeScriptCompiler.Plugin (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/broccoli-plugin/index.js:10:31)
remote:        at BroccoliTypeScriptCompiler.CachingWriter [as constructor] (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/broccoli-caching-writer/index.js:21:10)
remote:        at BroccoliTypeScriptCompiler (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:26:49)
remote:        at Angular2App._getTsTree (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/angular2-app.js:331:18)
remote:        at Angular2App._buildTree (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/angular2-app.js:124:23)
remote:        at new Angular2App (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23)
remote:        at module.exports (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/angular-cli-build.js:10:10)
remote:        at Class.module.exports.Task.extend.setupBroccoliBuilder (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19)
remote:        at Class.module.exports.Task.extend.init (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10)
remote:        at new Class (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12)
remote:        at Class.module.exports.Task.extend.run (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/angular-cli/lib/tasks/build.js:15:19)
remote:        at /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/angular-cli/lib/commands/build.js:32:24
remote:        at lib$rsvp$$internal$$tryCatch (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
remote:        at lib$rsvp$$internal$$invokeCallback (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
remote:        at /tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11
remote:        at lib$rsvp$asap$$flush (/tmp/build_62d8b6dd78169ce94281eaec1000a797/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
remote:        
remote:        
remote:        
remote:        
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:        Some possible problems:
remote:        
remote:        - Node version not specified in package.json
remote:        https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 damp-spire-94406.
remote: 
To https://git.heroku.com/damp-spire-94406.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/damp-spire-94406.git'