Skip to content

Install generator ignores --package-manager option in several placesΒ #269

@gordysc

Description

@gordysc

Description

I setup my Rails project with bun, but when running the install generator with --package-manager=bun (or yarn/pnpm), it looks like the generator still uses hardcoded npm commands in several places, causing errors like sh: 1: npm: not found when npm is not installed.

Steps to Reproduce

  1. Install the gem in a Rails project with --javascript=bun
  2. Run bin/rails generate inertia:install --package-manager=bun
  3. User sees a npm: not found error

Affected Code Locations

lib/generators/inertia/install/install_generator.rb

  1. Lines 131-133: TypeScript check scripts use npm pkg set
    run 'npm pkg set scripts.check="..."' if svelte?
    run 'npm pkg set scripts.check="..."' if framework == 'vue'
    run 'npm pkg set scripts.check="..."' if framework == 'react'
  2. Line 266: Version resolution uses npm show
    npm show @inertiajs/core@#{options[:inertia_version]} version --json | tail -n2 | head -n1 | tr -d '", '.strip

I think 2 is where my current error is coming from, but 1 might be worth checking as well.

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