webpacker: Webpacker is breaking webpack

When I run webpack, I get the following error:

webpack config /Users/nicholas/cs_projects/content-editor/config/webpack/development.js not found, please run 'bundle exec rails webpacker:install' to install Webpacker with default configs or add the missing config file for your custom environment.

This appears to be a webpacker error. Why this is affecting webpack, I have no idea.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 27 (13 by maintainers)

Most upvoted comments

Okay, I figured out the cause of the issue.

@gauravtiwari, I don’t think you understood in the slightest my issue. I am NOT trying to use webpacker outside of Ruby or Rails, I am NOT even trying to use webpacker. I’m simply attempting to use Webpack, good, normal old Webpack, and your gem is breaking that.

@georgeclaghorn, thank you for that advice, made me remember that I can just look up the source of the executable with which webpack. Basically, webpacker installs two binstubs: webpack and webpack-dev-server. But guess what? That happens to be the exact commands that Webpack uses. Y’know, Webpack, the thing you guys are building on? So if you have the misfortune of installing Webpacker globally, which, I stupidly did, then you break Webpack. I’d highly suggest not doing that.

So yeah. Please don’t name binstubs common executable names. It just creates a whole bunch of shadowing issues. Granted, I also have an npm issue at hand, but I do think naming your binstubs webpack and webpack-dev-server is asking for trouble. Why not webpacker and webpacker-dev-server?

@NicholasLYang Thank you for surfacing this issue. Your suggestions make sense. But, whether it was intended or not, it would be easy to interpret the wording of some of your comments as a bit harsh or, at best, unnecessarily sarcastic. Please consider the maintainers of this project are doing everything they can with what little time they have to help and respond to issues like yours and others as well.

Perhaps, consider uninstalling webpacker gem to remove executables from global namespace?

gem uninstall webpacker

This is because you still have the webpacker shim installed by rbenv in your shell’s $PATH: /Users/philipjohnson/.rbenv/versions/2.5.0/bin/webpack

First you need to uninstall Webpacker as it seems to have been installed globally: gem uninstall -a webpacker. Then, if not already deleted, you can safely remove it: rm /Users/philipjohnson/.rbenv/versions/2.5.0/bin/webpack

@ViggoV The global executables are removed in latest release. You would need to update binstubs after update, please see changelog.

bundle update webpacker
yarn add @rails/webpacker
bundle exec rails webpacker:binstubs # should replace old exe

@NicholasLYang I had the same problem. I was trying out Webpacker in another branch and upon switching back out of that branch, your original error message appeared. a quick which webpack found it in /user/nik/.rvm/gems/ruby-2.4.1@sync/bin/webpack. A gem uninstall webpacker, which also prompted for removal of these two executables, did the trick. Hope that helps

No. This is not a Rails specific issue. I’m trying to run webpack in a completely non Rails, non Ruby context (writing an npm package). Running bundle exec rails webpacker:install will do nothing.

On Tue, Jan 9, 2018 at 21:06 Bryan Lim notifications@github.com wrote:

Did you follow the instruction: please run ‘bundle exec rails webpacker:install’ to install Webpacker with default configs or add the missing config file for your custom environment.

Can you show us the repo and how you recreate this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rails/webpacker/issues/1165#issuecomment-356477417, or mute the thread https://github.com/notifications/unsubscribe-auth/AHBFpxwusHJTAD-X9ismx9DKdKYkoG1Iks5tJBszgaJpZM4RYh2l .

@gauravtiwari, yes I uninstalled Webpacker. Didn’t fix my issue, but at this point, that’s not Webpacker’s fault, so not going to post it here. I’m not entirely sure how “I’m trying to run webpack in a completely non Rails, non Ruby context” is ambiguous, since I didn’t say “I’m trying to run webpacker in a completely non Rails, non Ruby context”, which would be rather confusing. Nonetheless, I do see that I was unnecessarily vague in my first post. I’ll try to be more clear from now on. To clarify, I was attempting to run Webpack, the Javascript library for bundling, but Webpacker, the Ruby wrapper for the Javascript library, was interfering with it.

@rossta Fair point, I’m sorry. I find it very frustrating that a tool that came with Rails is breaking a fair portion of my JavaScript projects. More than a little harmful to productivity. Thank you for all the work you guys put into making Rails great.