excid3 / jumpstart

Easily jumpstart a new Rails application with a bunch of great features by default

Home Page:http://jumpstartrails.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bin/dev failing for a new rails app

giuseb opened this issue · comments

My setup:

rails 7.0.0.alpha2
node v14.17.6
npm 6.14.15
yarn 1.22.10
ruby 3.0.2
foreman 0.87.2

My attempt:

$ rails new jumping -m https://raw.githubusercontent.com/excid3/jumpstart/master/template.rb --skip-javascript
$ cd jumping
$ rails db:create db:migrate
$ bin/dev

09:09:28 web.1    | started with pid 27464
09:09:28 worker.1 | started with pid 27465
09:09:28 js.1     | started with pid 27466
09:09:28 css.1    | started with pid 27467
09:09:28 css.1    | yarn run v1.22.10
09:09:28 js.1     | yarn run v1.22.10
09:09:28 css.1    | error Command "build:css" not found.
09:09:28 js.1     | error Command "build" not found.
09:09:28 css.1    | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
09:09:28 js.1     | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
09:09:29 css.1    | exited with code 1
09:09:29 system   | sending SIGTERM to all processes
09:09:29 js.1     | exited with code 1
09:09:29 worker.1 | terminated by SIGTERM
09:09:29 web.1    | terminated by SIGTERM

Anything to do with jumpstart?
Thanks!

@giuseb Confirm you have this in package.json

"scripts": {
    "build": "node esbuild.config.js",
    "build:css": "sass ./app/assets/stylesheets/application.bootstrap.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules" 
  }

@gathuku, I did not have this snippet, now it works, thank you.

Shouldn't this be inserted by the jumpstart script, or at least mentioned in the readme?

There's a command for that npm set-script from npm >= 7.1. Time to upgrade npm :)

jumpstart/template.rb

Lines 244 to 252 in 51f8376

def add_esbuild_script
build_script = "node esbuild.config.js"
if (`npx -v`.to_f < 7.1 rescue "Missing")
say %(Add "scripts": { "build": "#{build_script}" } to your package.json), :green
else
run %(npm set-script build "#{build_script}")
end
end

Ah, yes, I re-ran the script and found the notice scrolling back, thank you.

May I suggest that, given the output's verbosity, all actionable information be shown at the end of the process, along the To get started with your new app: block.

Cheers!

@giuseb the suggestion is good, Am sure @excid3 will like it.