tuplejump / play-yeoman

Play + Yeoman integration sbt and play plugins
Apache License 2.0
237 stars 58 forks source link

Angular resources not being pulled when distributing? #81

Closed romatthe closed 9 years ago

romatthe commented 9 years ago

I've been using play-yeoman for a little while now, and it's pretty neat and works nice when in development.

Yesterday, as a test, I pushed my repo to Heroku to see how play-yeoman handles it, but it does not seem to work.

I'm very new to frond end development, and as such I'm also not very knowledgeable concerning grunt, npm, deployment of angular apps, etc., for apologies for that beforehand.

Basically it looks like the grunt task never runs because grunt is not available, so I'm guessing none of the bower and node modules are being pulled?

Here's the remote output from Heroku after doing a git push heroku master

remote:        'force' enabled
remote:        Will run: [grunt, --gruntfile=Gruntfile.js, --force] in /tmp/scala_buildpack_build_dir/ui
remote:        java.io.IOException: Cannot run program "grunt" (in directory "/tmp/scala_buildpack_build_dir/ui"): error=2, No such file or directory
remote:         at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
remote:         at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:349)
remote:         at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:126)
remote:         at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:125)
remote:         at com.tuplejump.sbt.yeoman.Yeoman$.com$tuplejump$sbt$yeoman$Yeoman$$runGrunt(Yeoman.scala:149)
remote:         at com.tuplejump.sbt.yeoman.Yeoman$$anonfun$7.apply(Yeoman.scala:77)
remote:         at com.tuplejump.sbt.yeoman.Yeoman$$anonfun$7.apply(Yeoman.scala:72)
remote:         at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
remote:         at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
remote:         at sbt.std.Transform$$anon$4.work(System.scala:63)
remote:         at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
remote:         at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
remote:         at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
remote:         at sbt.Execute.work(Execute.scala:235)
remote:         at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
remote:         at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
remote:         at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
remote:         at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
remote:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
remote:         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
remote:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
remote:         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
remote:         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
remote:         at java.lang.Thread.run(Thread.java:745)
remote:        Caused by: java.io.IOException: error=2, No such file or directory
remote:         at java.lang.UNIXProcess.forkAndExec(Native Method)
remote:         at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
remote:         at java.lang.ProcessImpl.start(ProcessImpl.java:134)
remote:         at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
remote:         at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:349)
remote:         at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:126)
remote:         at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:125)
remote:         at com.tuplejump.sbt.yeoman.Yeoman$.com$tuplejump$sbt$yeoman$Yeoman$$runGrunt(Yeoman.scala:149)
remote:         at com.tuplejump.sbt.yeoman.Yeoman$$anonfun$7.apply(Yeoman.scala:77)
remote:         at com.tuplejump.sbt.yeoman.Yeoman$$anonfun$7.apply(Yeoman.scala:72)
remote:         at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
remote:         at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
remote:         at sbt.std.Transform$$anon$4.work(System.scala:63)
remote:         at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
remote:         at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
remote:         at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
remote:         at sbt.Execute.work(Execute.scala:235)
remote:         at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
remote:         at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
remote:         at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
remote:         at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
remote:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
remote:         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
remote:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
remote:         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
remote:         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
remote:         at java.lang.Thread.run(Thread.java:745)
remote:        [error] (*:Task to run dist grunt) java.io.IOException: Cannot run program "grunt" (in directory "/tmp/scala_buildpack_build_dir/ui"): error=2, No such file or directory
remote:        [error] Total time: 0 s, completed Aug 25, 2015 2:15:15 AM
remote:
remote:  !     ERROR: Failed to run sbt!
remote:        We're sorry this build is failing! If you can't find the issue in application
remote:        code, please submit a ticket so we can help: https://help.heroku.com
remote:        You can also try reverting to the previous version of the buildpack by running:
remote:        $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-scala#previous-version
remote:
remote:        Thanks,
remote:        Heroku
remote:
remote:
remote:  !     Push rejected, failed to compile Play 2.x - Scala app
remote:
remote: Verifying deploy....
remote:
remote: !   Push rejected to rocky-springs-4014.
remote:
To https://git.heroku.com/rocky-springs-4014.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/rocky-springs-4014.git'

I think I'm using the basic project structure that is being advised, please have a look:

app
├── Global.scala
├── controllers
│   └── Application.scala
└── twitter
    ├── Tweet.scala
    ├── TweetStream.scala
    └── TweetStreamActor.scala
conf
├── application.conf
├── logback.xml
└── routes
test
├── ApplicationSpec.scala
└── IntegrationSpec.scala
ui
├── Gruntfile.js
├── app
│   ├── images
│   ├── index.html
│   ├── scripts
│   │   ├── app.js
│   │   ├── controllers
│   │   │   └── controllers.js
│   │   ├── directives
│   │   │   └── directives.js
│   │   ├── js
│   │   │   └── animations.js
│   │   └── services
│   │       └── services.js
│   ├── styles
│   │   ├── animations.css
│   │   └── main.css
│   └── views
│       └── tweetcard.html
├── bower.json
├── dist
│   └── index.html
├── package.json
├── test
│   ├── karma.conf.js
│   └── unit
│       └── tweetControllerSpec.js
├── tsd.json
└── typings
    ├── angular-protractor
    │   └── angular-protractor.d.ts
    ├── angularjs
    │   └── angular.d.ts
    ├── jasmine
    │   └── jasmine.d.ts
    └── tsd.d.ts

And finally here are my build files:

build.sbt

import com.tuplejump.sbt.yeoman.Yeoman

name := """twitterstream"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

Yeoman.yeomanSettings ++ Yeoman.withTemplates

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  specs2 % Test
)

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator

plugins.sbt

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")

// Yeoman-Play plugin
addSbtPlugin("com.tuplejump" % "sbt-yeoman" % "0.8.1")
Shiti commented 9 years ago

The prerequisites should be installed and you also need to execute the following before starting the application

$node install
$bower install