simonbo

simonbo

Modern Front-End Development for Rails - Webpacker and Unexpected token errors

Hello,

While trying to run the code examples from the book I always encounter the same issues that seem to be caused, maybe among other potential suspects, by webpacker.

I mostly get Unexpected token errors when webpacker tries to compile. It seems that Typescript isn’t well parsed.

By following some of the instructions described in webpacker’s README I managed sometimes before the use of Stimulus and React in the book to make it works. However once both frameworks present, I did not find my way through all those errors, to be honest.

So at this point, I can’t move forward in the book it became quite a struggle to fix here and there potential versions conflicts.

Would not it be interesting to freeze the versions of some gems/library in the Gemfile and the package.json?

Also before trying to run anything in a project directory, yarn always asks to proceed to do an integrity check, a bundle exec rails whatever can’t be run until it’s done. I don’t know if it can also play in upgrading automatically the versions that aren’t locked and thus maybe cause some issues later on.

error Couldn't find an integrity file                                                                                                     
error Found 1 errors.                                                                                                                     


========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================


To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).


yarn check v1.22.4
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.

Thanks for the help, I really enjoy the book and would love to move forward through the practical aspect. :slight_smile:

Simon

Most Liked

noelrappin

noelrappin

Author of Modern Front-End Development for Rails

So, there are some versioning issues here. My plan has been to wait until the book goes final to lock the versions in the source code – it makes it easier for me to keep up while the book is in progress.

There are issues with Webpacker 5.1 and the Stimulus controllers (see https://github.com/stimulusjs/stimulus/issues/303), and I haven’t incorporated that fix into the book yet, so I’d try fixing Webpacker to ~5.0 and see if that helps.

Popular Prag Prog topics Top

jesse050717
Title: Web Development with Clojure, Third Edition, pg 116 Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
jeremyhuiskamp
Title: Web Development with Clojure, Third Edition, vB17.0 (p9) The create table guestbook syntax suggested doesn’t seem to be accepted ...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
jonmac
The allprojects block listed on page 245 produces the following error when syncing gradle: “org.gradle.api.GradleScriptException: A prob...
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New
dachristenson
@mfazio23 Android Studio will not accept anything I do when trying to use the Transformations class, as described on pp. 140-141. Googl...
New

Other popular topics Top

AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
New
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New

Latest in PragProg

View all threads ❯