Skip to content

Could not find asset in entry file error help

Travis Hoover edited this page Jun 15, 2021 · 1 revision

The following error:

Could not find app javascript: "/assets/foobar.js" in index.html. Found the following instead:
 - assets/vendor.js
 - assets/foobar.js

refers to Embroider not being able to find certain assets located in either your index.html or tests/index.html files. Generally, this occurs because you are missing {{rootURL}} from your index file such as:

Bad:

<script src="assets/vendor.js"></script>
<script src="assets/foobar.js"></script>

Good:

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/foobar.js"></script>

Embroider will be looking for the following asset so you will need to make sure that they exist in your index files:

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/APPNAME.js"></script>
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/APPNAME.css">

Additionally, if you have configured outputPaths in ember-cli-build.js you may run into this error if that configuration does not point to a valid asset listed in the index file. However, outputPaths are not supported under Embroider so it is recommended that you migrate off of outputPaths and completely remove the configuration.

Clone this wiki locally