How to Fix Protractor Error: Could not find update-config.json
A complete troubleshooting guide for the common Protractor error 'Could not find update-config.json'. Learn how to update WebDriver Manager and automate binary downloads.
Introduction
🎯 Quick Answer
To fix the 'Could not find update-config.json' error in Protractor, you must update your WebDriver binaries. Run the command node node_modules/protractor/bin/webdriver-manager update in your project's root directory. This will download the necessary browser drivers (like ChromeDriver) and generate the missing update-config.json file required for directConnect to function.
If you are working with Protractor for end-to-end testing, you might occasionally encounter a frustrating error that stops your tests from running: 'Could not find update-config.json'. This error typically occurs when the WebDriver Manager hasn't been initialized, updated, or the binaries are missing from the expected location.
📖 Key Definitions
- update-config.json
A configuration file generated by
webdriver-managerthat maps browser driver versions to their local file paths.- webdriver-manager
A helper tool included with Protractor that manages Selenium Server and browser driver binaries (ChromeDriver, GeckoDriver, etc.).
- directConnect
A Protractor configuration setting that allows tests to communicate directly with browser drivers without needing a standalone Selenium Server.
- Binaries
The executable files (like
chromedriver.exe) that act as the bridge between your test code and the actual browser.
Understanding the Error
The full error message usually looks something like this:
[17:05:22] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
This happens because Protractor's directConnect feature requires a configuration file (update-config.json) that tells it where the browser driver binaries are located. If you haven't run the update command, this file won't exist, and Protractor won't know how to launch the browser.
🚀 Step-by-Step Implementation
Open Your Terminal
Open your command prompt, terminal, or integrated terminal in Visual Studio Code.
Navigate to Project Root
Ensure you are in the root directory of your project where the node_modules folder is located.
Run the Update Command
Execute the following command to download the latest drivers:
node node_modules/protractor/bin/webdriver-manager update
Note: If you have Protractor installed globally, you can simply run webdriver-manager update.
Verify Binary Download
Check the node_modules/protractor/node_modules/webdriver-manager/selenium/ directory. You should see update-config.json and several driver executables.
Restart Your Tests
Run your Protractor tests again. The error should now be resolved.
Common Causes of the Error
- New Environment: You just cloned the project and ran
npm install, but the WebDriver binaries (which are often ignored by.gitignore) weren't downloaded. - Browser Update: Your Chrome or Firefox browser updated automatically, and the old driver version is no longer compatible or the path has shifted.
- Clean Install: You deleted
node_modulesand reinstalled, which cleared the local binaries but didn't trigger a re-download. - Missing postinstall Script: The project doesn't have an automated way to update drivers after an
npm install.
Common Errors & Best Practices
⚠️ Common Errors & Pitfalls
- Permission Denied (EACCES)
Occurs on macOS/Linux when the user doesn't have write access to the
node_modulesfolder. Usesudoor fix folder permissions. - Network/Proxy Issues
The update command might fail if you're behind a corporate proxy. You may need to pass proxy arguments:
--proxy http://your-proxy:port. - Version Mismatch
Even after updating, you might get a "SessionNotCreatedError" if your local Chrome version is much newer than the downloaded ChromeDriver. Run
webdriver-manager updateagain to get the latest.
✅ Best Practices
- ✔Add a
"postinstall": "webdriver-manager update"script to yourpackage.jsonto automate this for all team members. - ✔Always run the update command after a major browser update (e.g., Chrome 120 to 121).
- ✔If using a CI/CD pipeline, ensure the update command is part of your build steps before running tests.
- ✔Use the
--versions.chromeflag if you need to pin a specific driver version for compatibility.
Frequently Asked Questions
Do I need to run this every time?
No, only when you set up the project on a new machine, update your browser, or clear your node_modules.
What if I don't use directConnect?
If you use a standalone Selenium Server, you still need to run webdriver-manager update to download the server and drivers, then webdriver-manager start.
Can I use this for Firefox too?
Yes, the update command downloads GeckoDriver (for Firefox) and IEDriver (for Internet Explorer) by default.
Conclusion
The "Could not find update-config.json" error is a common hurdle in Protractor setup, but it's easily fixed by ensuring your WebDriver binaries are up to date. By automating this process with a postinstall script, you can prevent this issue from recurring and ensure a smoother experience for your entire development team.
📝 Summary & Key Takeaways
The 'Could not find update-config.json' error in Protractor is caused by missing or uninitialized browser driver binaries required for the directConnect feature. Resolving this involves running the webdriver-manager update command within the project's root directory to download necessary drivers like ChromeDriver. To prevent this issue in collaborative environments, it is best practice to include the update command in a package.json postinstall script. This ensures that every developer has the correct binaries after a standard npm install, maintaining test stability across different machines and browser versions.
Share it with your network and help others learn too!
Follow me on social media for more developer tips, tricks, and tutorials. Let's connect and build something great together!