ENOENT: no such file or directory, open ".../tmp/source_map_concat-input_base_path-25zKGwjR.tmp/bower_components/Faker/build/build/faker.js"

Hi everyone,

I’ve run into an issue building my Ember app. A little background:

My app is running Ember v2.14*, and so we use both Yarn and Bower as package managers. One of the bower components we use is Faker.js (version 3.0.0), and as you may know, its author took down the repo early this month (January 2022). This caused build errors due to being unable to install from the repo. To confirm, I cleared my caches with yarn cache clean && bower cache clean, removed all packages with rm -rf bower_components node_modules, and then tried to re-install them with yarn install && bower install. The bower install fails because the Faker.js repo can’t be found.

The community has since forked and published Faker.js in a new GH repo, @faker-js/faker. I updated my bower.json file to point to this new repo:

"dependencies": {
  "Faker": "@faker-js/faker",

After making this change, bower install succeeds. I’m able to successfully start the server with ember s, but when trying to navigate, I get an error page with the following message:

ENOENT: no such file or directory, open ".../tmp/source_map_concat-input_base_path-25zKGwjR.tmp/bower_components/Faker/build/build/faker.js"

It seems to me like the project still held a reference to the old version of Faker somewhere. I’ve been Googling how to solve this issue and tried the following solutions:

  • Move Faker.js from bower.json to package.json
  • Upgraded Ember to v3
  • Ensured I have no references to bower_components/Faker/build/build/faker.js in the code, especially ember-cli-build.js
  • Removing Faker.js from the project to see if I can get another error

None of the above changed the outcome, and I’m starting to come up dry on solutions. From the error I saw above, it seems like the source maps being generated by either broccoli or babel, I’m not sure, still have references to the old Faker.js, and I’m not sure why that’s happening. Can anyone help me figure out why this is happening?

Thank you in advance for any help you can provide!

* Yes, I know that’s very out of date at this point, but I’m not in a position where I can go through upgrading it right now. If at all possible, I’d like to find a solution that will let me stay on this version.

This part seems very suspicious to me… it’s still throwing the same error even after you remove it?

Are you using an older version of ember-cli-mirage (pre v1.0.0)? It used to include its own faker and in 1.0.0 release it dropped it as a dependency, but if you have a < 1.0.0 version it might still be trying to include the original repo in the build. If that’s the case you could try upgrading mirage to ~1.0.0, although it’s possible that will have its own compatibility issues. If that doesn’t work maybe you could create a fork of mirage at the version you’re using and change its faker dependency to the new faker fork?

EDIT: The commit from mirage that removed faker.js definitely appears to be referencing faker with the above path so that adds up.