Code Monkey home page Code Monkey logo

Comments (5)

excid3 avatar excid3 commented on July 22, 2024

What command did you run?

from jumpstart.

eclectic-coding avatar eclectic-coding commented on July 22, 2024

rails new jumpstart_app --no-rc -m ./jumpstart/template.rb

I used --no-rc to ignore my local .railsrc.

from jumpstart.

eclectic-coding avatar eclectic-coding commented on July 22, 2024

So, if I create a default rails 7 app (importmaps), add jsbundling-rails gem, and then run command for esbuild, I get the same error.
This might be an issue with the gem.

from jumpstart.

ybakos avatar ybakos commented on July 22, 2024

Adding to this.

rails new myapp -d postgresql -m https://raw.githubusercontent.com/excid3/jumpstart/master/template.rb

Install esbuild
         run  yarn add esbuild from "."
yarn add v1.22.18
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 2 new dependencies.
info Direct dependencies
└─ [email protected]
info All dependencies
├─ [email protected]
└─ [email protected]
✨  Done in 1.06s.
Add build script
         run  npm set-script build "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds" from "."
         run  yarn build from "."
yarn run v1.22.18
$ esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds
✘ [ERROR] Could not resolve "@hotwired/turbo-rails"

    app/javascript/application.js:2:7:
      2 │ import "@hotwired/turbo-rails"
        ╵        ~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@hotwired/turbo-rails" as external to exclude it from the bundle,
  which will remove this error.

✘ [ERROR] Could not resolve "controllers"

    app/javascript/application.js:3:7:
      3 │ import "controllers"
        │        ~~~~~~~~~~~~~
        ╵        "./controllers"

  Use the relative path "./controllers" to reference the file
  "app/javascript/controllers/index.js". Without the leading "./", the path "controllers"
  is being interpreted as a package path instead.

2 errors
node:child_process:867
    throw err;
    ^

Error: Command failed: /Users/bakosy/tmp/myapp/node_modules/esbuild-darwin-64/bin/esbuild app/javascript/application.js --bundle --sourcemap --outdir=app/assets/builds
    at checkExecSyncError (node:child_process:826:11)
    at Object.execFileSync (node:child_process:864:15)
    at Object.<anonymous> (/Users/bakosy/tmp/myapp/node_modules/esbuild/bin/esbuild:172:28)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 13020,
  stdout: null,
  stderr: null
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
         run  yarn add local-time esbuild-rails trix @hotwired/stimulus @hotwired/turbo-rails @rails/activestorage @rails/ujs @rails/request.js from "."
yarn add v1.22.18
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 20 new dependencies.
info Direct dependencies
├─ @hotwired/[email protected]
├─ @hotwired/[email protected]
├─ @rails/[email protected]
├─ @rails/[email protected]
├─ @rails/[email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ @hotwired/[email protected]
├─ @hotwired/[email protected]
├─ @hotwired/[email protected]
├─ @rails/[email protected]
├─ @rails/[email protected]
├─ @rails/[email protected]
├─ @rails/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
✨  Done in 3.01s.

from jumpstart.

ybakos avatar ybakos commented on July 22, 2024

A little more...

~/tmp/myapp$ npm run build

> build
> esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds

✘ [ERROR] Could not resolve "@hotwired/turbo-rails"

    app/javascript/application.js:2:7:
      2 │ import "@hotwired/turbo-rails"
        ╵        ~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@hotwired/turbo-rails" as external to exclude it from
  the bundle, which will remove this error.

✘ [ERROR] Could not resolve "controllers"

    app/javascript/application.js:3:7:
      3 │ import "controllers"
        │        ~~~~~~~~~~~~~
        ╵        "./controllers"

  Use the relative path "./controllers" to reference the file
  "app/javascript/controllers/index.js". Without the leading "./", the path
  "controllers" is being interpreted as a package path instead.

2 errors

from jumpstart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.