shakapacker: Bump from v6.5.5 to v6.5.6 caused `error Command "webpack" not found.`
Started seeing the error after upgrading from v6.5.5 to v6.5.6. Reversing fixed the issue.
Expected behavior:
Assets compilation to complete without errors
Actual behavior:
Failure to complete assets:precompile on production.
...suppressed output....
Writing pagy-module.d-2ae43d1f2559cebcbe95eeb7b90519fdd958ee79.ts"
I, [2023-02-14T14:29:14.566397 #7] INFO -- : Compiling...
E, [2023-02-14T14:29:15.520103 #7] ERROR -- :
COMPILATION FAILED:
EXIT STATUS: pid 21 exit 1
OUTPUTS:
yarn run v1.22.19
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command "webpack" not found.
Small, reproducible repo:
Setup environment:
- Ruby version: 3.1.2
- Rails version: 7.0.4.2
- Shakapacker version: 6.5.5
- yarn packages are installed automatically
Could this be related to an outdated binstub?
Running rails webpacker:install locally again
Copying binstubs
exist bin
conflict bin/webpacker
Overwrite /bin/webpacker? (enter "h" for help) [Ynaqdhm] d
#!/usr/bin/env ruby
- require "pathname"
+ ENV["RAILS_ENV"] ||= "development"
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
+
require "bundler/setup"
require "webpacker"
require "webpacker/webpack_runner"
-
- ENV["RAILS_ENV"] ||= "development"
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)
APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
Webpacker::WebpackRunner.run(ARGV)
end
Retrying...
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 15 (10 by maintainers)
@Alex-450 my setup is currently relying on executing
yarn installonly whenassets:precompileis executed.I’ll probably add a step to execute the install anyway, since shakapacker version 7 will no longer execute it with the precompile step.
Was having the same issue and fixed by adding
yarn install --frozen-lockfile --immutableto the node setup, as setup-node doesn’t cache node_modules.Not sure if this is also relevant for you @raivil
@justin808 Just switched the buildpack order (with
nodebeforeruby) and can confirm it successfully built with 6.6.0.AFAIK, the heroku/nodejs build pack installs yarn dependencies.
Maybe you have the nodejs buildpack AFTER the ruby. If so, you’ll get the error above, as precompile runs as part of the ruby buildpack.
@ahangarha we probably need to document this.