1

Sprockets::DoubleLinkError: Multiple files with the same output path cannot be linked ("application.js") in Rails 7.

After compiling assets: enter image description here

Here is my manifest.json: enter image description here

Directory structure: enter image description here

1 Answers1

0

I had this error message before and this comment from DHH helped me resolve it.

You have to rename one of the two files. They're both being generated at the same path which doesn't work. Normally if you use builds/application.js you don't also need app/assets/javascripts/application.js.

I renamed app/assets/javascripts/application.js to app/assets/javascripts/application.assets.js and the error resolves until the server restarts and the build asset is generated again.

Removing:

//= link_tree ../../javascript .js

from manifest.js resolved appears to actually resolve the issue. Since you don't need to load application.js if you are loading the builds folder.

J Woods
  • 138
  • 1
  • 8