Skip to content

Generating a Rails 7.1.0.beta1 app with bootstrap throws an error #133

Closed
@joshrickard

Description

@joshrickard

Steps to reproduce

Generating a Rails app with 7.1.0.beta1 using bootstrap throws an error.

This seems to be related to Procfile.dev not existing when cssbundling-rails tries to update the file. Not entirely sure if this belongs here or in the cssbundling-rails repo.

rails --version
Rails 7.1.0.beta1

Minimal reproduction case:

rails new blog -c bootstrap

      create
      create  README.md
      create  Rakefile
      create  .node-version
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  .gitattributes
      create  Gemfile
         run  git init -b main from "."
Initialized empty Git repository in /Users/josh/dev/blog/.git/
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images
      create  app/assets/images/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  Dockerfile
      create  .dockerignore
      create  bin/docker-entrypoint
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/new_framework_defaults_7_1.rb
      create  config/initializers/permissions_policy.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      append  .gitignore
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  tmp
      create  tmp/.keep
      create  tmp/pids
      create  tmp/pids/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  vendor/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/channels/application_cable/connection_test.rb
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  storage
      create  storage/.keep
      create  tmp/storage
      create  tmp/storage/.keep
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_7_1.rb
         run  bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Bundle complete! 16 Gemfile dependencies, 84 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle lock --add-platform=x86_64-linux
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
         run  bundle lock --add-platform=aarch64-linux
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
         run  bundle binstubs bundler
       rails  importmap:install
       apply  /Users/josh/.rvm/gems/ruby-3.2.2/gems/importmap-rails-1.2.1/lib/install/install.rb
  Add Importmap include tags in application layout
      insert    app/views/layouts/application.html.erb
  Create application.js module as entrypoint
      create    app/javascript/application.js
  Use vendor/javascript for downloaded pins
      create    vendor/javascript
      create    vendor/javascript/.keep
  Ensure JavaScript files are in the Sprocket manifest
      append    app/assets/config/manifest.js
  Configure importmap paths in config/importmap.rb
      create    config/importmap.rb
  Copying binstub
      create    bin/importmap
         run  bundle install
Bundle complete! 16 Gemfile dependencies, 84 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
         run  bundle lock --add-platform=aarch64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
       rails  turbo:install stimulus:install
       apply  /Users/josh/.rvm/gems/ruby-3.2.2/gems/turbo-rails-1.4.0/lib/install/turbo_with_importmap.rb
  Import Turbo
      append    app/javascript/application.js
  Pin Turbo
      append    config/importmap.rb
         run  bundle install
Bundle complete! 16 Gemfile dependencies, 84 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
         run  bundle lock --add-platform=aarch64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
       apply  /Users/josh/.rvm/gems/ruby-3.2.2/gems/turbo-rails-1.4.0/lib/install/turbo_needs_redis.rb
  Enable redis in bundle
        gsub    Gemfile
         run    bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundle complete! 17 Gemfile dependencies, 86 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run    bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
         run    bundle lock --add-platform=aarch64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
  Switch development cable to use redis
        gsub    config/cable.yml
         run  bundle install
Bundle complete! 17 Gemfile dependencies, 86 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
         run  bundle lock --add-platform=aarch64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
       apply  /Users/josh/.rvm/gems/ruby-3.2.2/gems/stimulus-rails-1.2.2/lib/install/stimulus_with_importmap.rb
  Create controllers directory
      create    app/javascript/controllers
      create    app/javascript/controllers/index.js
      create    app/javascript/controllers/application.js
      create    app/javascript/controllers/hello_controller.js
  Import Stimulus controllers
      append    app/javascript/application.js
  Pin Stimulus
  Appending: pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true"
      append    config/importmap.rb
  Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
      append    config/importmap.rb
  Pin all controllers
  Appending: pin_all_from "app/javascript/controllers", under: "controllers"
      append    config/importmap.rb
         run  bundle install
Bundle complete! 17 Gemfile dependencies, 86 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
         run  bundle lock --add-platform=aarch64-linux
Writing lockfile to /Users/josh/dev/blog/Gemfile.lock
       rails  css:install:bootstrap
       apply  /Users/josh/.rvm/gems/ruby-3.2.2/gems/cssbundling-rails-1.3.1/lib/install/install.rb
  Build into app/assets/builds
      create    app/assets/builds
      create    app/assets/builds/.keep
      append    app/assets/config/manifest.js
  Stop linking stylesheets automatically
        gsub    app/assets/config/manifest.js
      append    .gitignore
      append    .gitignore
  Remove app/assets/stylesheets/application.css so build output can take over
      remove    app/assets/stylesheets/application.css
  Add stylesheet link tag in application layout
File unchanged! Either the supplied flag value not found or the content has already been inserted!    app/views/layouts/application.html.erb
  Add default package.json
      create    package.json
  Add default Procfile.dev
bin/rails aborted!
Rails::Generators::Error: The template [/Users/josh/.rvm/gems/ruby-3.2.2/gems/cssbundling-rails-1.3.1/lib/install/install.rb] could not be loaded. Error: Could not find "/Users/josh/.rvm/gems/ruby-3.2.2/gems/cssbundling-rails-1.3.1/lib/install/Procfile_for_node" in any of your source paths. Your current source paths are:
/Users/josh/.rvm/gems/ruby-3.2.2/gems/railties-7.1.0.beta1/lib/rails/generators/rails/app/templates


Caused by:
Thor::Error: Could not find "/Users/josh/.rvm/gems/ruby-3.2.2/gems/cssbundling-rails-1.3.1/lib/install/Procfile_for_node" in any of your source paths. Your current source paths are:
/Users/josh/.rvm/gems/ruby-3.2.2/gems/railties-7.1.0.beta1/lib/rails/generators/rails/app/templates

Tasks: TOP => app:template
(See full trace by running task with --trace)
       apply  /Users/josh/.rvm/gems/ruby-3.2.2/gems/cssbundling-rails-1.3.1/lib/install/bootstrap/install.rb
  Install Bootstrap with Bootstrap Icons, Popperjs/core and Autoprefixer
      create    app/assets/stylesheets/application.bootstrap.scss
         run    yarn add sass bootstrap bootstrap-icons @popperjs/core postcss postcss-cli autoprefixer nodemon from "."
yarn add v1.22.17
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 94 new dependencies.
info Direct dependencies
├─ @popperjs/core@2.11.8
├─ autoprefixer@10.4.15
├─ bootstrap-icons@1.11.0
├─ bootstrap@5.3.1
├─ nodemon@3.0.1
├─ postcss-cli@10.1.0
├─ postcss@8.4.29
└─ sass@1.66.1
info All dependencies
├─ @nodelib/fs.scandir@2.1.5
├─ @nodelib/fs.stat@2.0.5
├─ @nodelib/fs.walk@1.2.8
├─ @popperjs/core@2.11.8
├─ abbrev@1.1.1
├─ ansi-regex@5.0.1
├─ ansi-styles@4.3.0
├─ anymatch@3.1.3
├─ autoprefixer@10.4.15
├─ balanced-match@1.0.2
├─ binary-extensions@2.2.0
├─ bootstrap-icons@1.11.0
├─ bootstrap@5.3.1
├─ brace-expansion@1.1.11
├─ braces@3.0.2
├─ browserslist@4.21.10
├─ caniuse-lite@1.0.30001534
├─ chokidar@3.5.3
├─ cliui@8.0.1
├─ color-convert@2.0.1
├─ color-name@1.1.4
├─ concat-map@0.0.1
├─ debug@3.2.7
├─ dependency-graph@0.11.0
├─ dir-glob@3.0.1
├─ electron-to-chromium@1.4.520
├─ emoji-regex@8.0.0
├─ fast-glob@3.3.1
├─ fastq@1.15.0
├─ fill-range@7.0.1
├─ fraction.js@4.3.6
├─ fs-extra@11.1.1
├─ fsevents@2.3.3
├─ get-caller-file@2.0.5
├─ get-stdin@9.0.0
├─ glob-parent@5.1.2
├─ globby@13.2.2
├─ graceful-fs@4.2.11
├─ has-flag@3.0.0
├─ ignore-by-default@1.0.1
├─ ignore@5.2.4
├─ immutable@4.3.4
├─ is-binary-path@2.1.0
├─ is-extglob@2.1.1
├─ is-fullwidth-code-point@3.0.0
├─ is-glob@4.0.3
├─ is-number@7.0.0
├─ jsonfile@6.1.0
├─ lilconfig@2.1.0
├─ lru-cache@6.0.0
├─ merge2@1.4.1
├─ micromatch@4.0.5
├─ minimatch@3.1.2
├─ ms@2.1.3
├─ nanoid@3.3.6
├─ node-releases@2.0.13
├─ nodemon@3.0.1
├─ nopt@1.0.10
├─ normalize-path@3.0.0
├─ normalize-range@0.1.2
├─ path-type@4.0.0
├─ picomatch@2.3.1
├─ pify@2.3.0
├─ postcss-cli@10.1.0
├─ postcss-load-config@4.0.1
├─ postcss-reporter@7.0.5
├─ postcss-value-parser@4.2.0
├─ postcss@8.4.29
├─ pretty-hrtime@1.0.3
├─ pstree.remy@1.1.8
├─ queue-microtask@1.2.3
├─ read-cache@1.0.0
├─ readdirp@3.6.0
├─ require-directory@2.1.1
├─ reusify@1.0.4
├─ run-parallel@1.2.0
├─ sass@1.66.1
├─ simple-update-notifier@2.0.0
├─ slash@5.1.0
├─ source-map-js@1.0.2
├─ string-width@4.2.3
├─ strip-ansi@6.0.1
├─ supports-color@5.5.0
├─ thenby@1.3.4
├─ to-regex-range@5.0.1
├─ touch@3.1.0
├─ undefsafe@2.0.5
├─ update-browserslist-db@1.0.11
├─ wrap-ansi@7.0.0
├─ y18n@5.0.8
├─ yallist@4.0.0
├─ yaml@2.3.2
├─ yargs-parser@21.1.1
└─ yargs@17.7.2
✨  Done in 3.06s.
      insert    config/initializers/assets.rb
  Appending Bootstrap JavaScript import to default entry point
      append    app/javascript/application.js
  Add build:css:compile script
         run    npm pkg set scripts.build:css:compile="sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules" from "."
         run    yarn build:css:compile from "."
yarn run v1.22.17
$ sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules
Deprecation Warning: Passing percentage units to the global abs() function is deprecated.
In the future, this will emit a CSS abs() function to be resolved by the browser.
To preserve current behavior: math.abs(100%)
To emit a CSS abs() now: abs(#{100%})
More info: https://sass-lang.com/d/abs-percent

   ╷
57 │   $dividend: abs($dividend);
   │              ^^^^^^^^^^^^^^
   ╵
    node_modules/bootstrap/scss/vendor/_rfs.scss 57:14         divide()
    node_modules/bootstrap/scss/mixins/_grid.scss 59:12        row-cols()
    node_modules/bootstrap/scss/mixins/_grid.scss 85:13        @content
    node_modules/bootstrap/scss/mixins/_breakpoints.scss 68:5  media-breakpoint-up()
    node_modules/bootstrap/scss/mixins/_grid.scss 72:5         make-grid-columns()
    node_modules/bootstrap/scss/_grid.scss 38:3                @import
    bootstrap/scss/bootstrap.scss 20:9                         @import
    app/assets/stylesheets/application.bootstrap.scss 1:9      root stylesheet

✨  Done in 1.42s.
  Add build:css:prefix script
         run    npm pkg set scripts.build:css:prefix="postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css" from "."
         run    yarn build:css:prefix from "."
yarn run v1.22.17
$ postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css
✨  Done in 0.62s.
  Add build:css script
         run    npm pkg set scripts.build:css="yarn build:css:compile && yarn build:css:prefix" from "."
         run    yarn build:css from "."
yarn run v1.22.17
$ yarn build:css:compile && yarn build:css:prefix
$ sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules
Deprecation Warning: Passing percentage units to the global abs() function is deprecated.
In the future, this will emit a CSS abs() function to be resolved by the browser.
To preserve current behavior: math.abs(100%)
To emit a CSS abs() now: abs(#{100%})
More info: https://sass-lang.com/d/abs-percent

   ╷
57 │   $dividend: abs($dividend);
   │              ^^^^^^^^^^^^^^
   ╵
    node_modules/bootstrap/scss/vendor/_rfs.scss 57:14         divide()
    node_modules/bootstrap/scss/mixins/_grid.scss 59:12        row-cols()
    node_modules/bootstrap/scss/mixins/_grid.scss 85:13        @content
    node_modules/bootstrap/scss/mixins/_breakpoints.scss 68:5  media-breakpoint-up()
    node_modules/bootstrap/scss/mixins/_grid.scss 72:5         make-grid-columns()
    node_modules/bootstrap/scss/_grid.scss 38:3                @import
    bootstrap/scss/bootstrap.scss 20:9                         @import
    app/assets/stylesheets/application.bootstrap.scss 1:9      root stylesheet

$ postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css
✨  Done in 1.76s.
  Add watch:css script
         run    npm pkg set scripts.watch:css="nodemon --watch ./app/assets/stylesheets/ --ext scss --exec "yarn build:css"" from "."
npm ERR! code EUSAGE
npm ERR!
npm ERR! npm pkg set expects a key=value pair of args.
npm ERR!
npm ERR! Manages your package.json
npm ERR!
npm ERR! Usage:
npm ERR! npm pkg set <key>=<value> [<key>=<value> ...]
npm ERR! npm pkg get [<key> [<key> ...]]
npm ERR! npm pkg delete <key> [<key> ...]
npm ERR! npm pkg set [<array>[<index>].<key>=<value> ...]
npm ERR! npm pkg set [<array>[].<key>=<value> ...]
npm ERR! npm pkg fix
npm ERR!
npm ERR! Options:
npm ERR! [-f|--force] [--json]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces]
npm ERR!
npm ERR! Run "npm help pkg" for more info

npm ERR! A complete log of this run can be found in: /Users/josh/.npm/_logs/2023-09-13T21_31_54_674Z-debug-0.log
        gsub    Procfile.dev
bin/rails aborted!
Rails::Generators::Error: The template [/Users/josh/.rvm/gems/ruby-3.2.2/gems/cssbundling-rails-1.3.1/lib/install/bootstrap/install.rb] could not be loaded. Error: No such file or directory @ rb_sysopen - /Users/josh/dev/blog/Procfile.dev


Caused by:
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/josh/dev/blog/Procfile.dev

Tasks: TOP => app:template
(See full trace by running task with --trace)

Expected behavior

Rails app is successfully generated.

Actual behavior

An error is thrown.

System configuration

Rails version: 7.1.0.beta1
Ruby version: 3.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions