Giter Club home page Giter Club logo

Comments (7)

thejonanshow avatar thejonanshow commented on July 29, 2024 29

For any who happen by here in the future trying to solve
File unchanged! The supplied flag value not found! app/javascript/packs/application.js:

Whatever your issue is it's probably not related to that message; despite being red and screamy it's more or less a warning.

During setup stimulus_reflex will run rails webpacker:install:stimulus, a perfectly logical thing to do. Somewhere down that rabbit hole thor is used to insert the import "controllers" line into the end of your application.js file. If you've already installed stimulus (by creating your Rails app with --webpack=stimulus for example) then thor will call replace!:

if replace!(/#{flag}/, content, config[:force])
  say_status(:invoke)
else
  say_status(:unchanged, warning: WARNINGS[:unchanged_no_flag], color: :red)
end

and when replace! returns nil (because content already includes replacement) 👇

def replace!(regexp, string, force)
  return if pretend?
  content = File.read(destination)
  if force || !content.include?(replacement)
    success = content.gsub!(regexp, string)

    File.open(destination, "wb") { |file| file.write(content) }
    success
  end
end

then say_status(:unchanged) will be called producing one glorious red error looking message to let you know nothing happened.

https://github.com/erikhuda/thor/blob/da1e707627578eacbf7c6336ed1bb22fb3abfb86/lib/thor/actions/inject_into_file.rb#L106-L117

At a glance I couldn't decide what I would have done differently to prevent this outcome, as it would probably involve adding a third state to replace! so nil is not used as both failure and already_replaced. That sounds like it would definitely end with significantly uglier code so I am instead opting to write a long warning to future adventurers.

Instead of typing this I could have been playing Minecraft...

I'm going to go play Minecraft. If you think of a way to change something here that would be more useful than a comment on a closed issue I encourage you to go for it.

from stimulus_reflex.

henrik avatar henrik commented on July 29, 2024 1

Closing! 👍

from stimulus_reflex.

henrik avatar henrik commented on July 29, 2024

I removed SR and re-installed it. The next time, I got

15:51:06 henrik@devbox remit  master$ bundle exec rails stimulus_reflex:install
warning Integrity check: Top level patterns don't match
error Integrity check failed
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.19.1
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.

I made sure to explicitly start bin/webpack-dev-server, then ran yarn install --check-files, and then ran bundle exec rails stimulus_reflex:install again. This time I didn't get that error.

from stimulus_reflex.

leastbad avatar leastbad commented on July 29, 2024

Paging @andrewmcodes, our resident rake expert.

from stimulus_reflex.

henrik avatar henrik commented on July 29, 2024

Cheers! Not blocked by this anymore but could help others :)

from stimulus_reflex.

leastbad avatar leastbad commented on July 29, 2024

@henrik super glad that you got this wrapped up.

Could you please close the issue if it's no longer unsolved?

from stimulus_reflex.

godfreymutebi avatar godfreymutebi commented on July 29, 2024

try installing node js 16 using nvm

from stimulus_reflex.

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.