How to Fix: Error: Local workspace file ('angular.json') could not be found
📋 Table of Contents
The error 'Local workspace file ('angular.json') could not be found' occurs when the Angular CLI is unable to locate the `angular.json` file, which contains configuration settings for the project.
This issue affects developers who have updated their version of `@angular/cli` and are using a Travis CI environment.
🛑 Root Causes of the Error
- The primary reason for this error is that the Angular CLI has changed its default location for storing workspace files. In older versions, it used to store these files in the root directory of the project. However, starting from version 6.0.0-rc.3, the Angular CLI now stores these files in a separate directory called `ng`.
- Another possible reason is that the `--workspace` flag was not provided when running the command that generated the workspace file.
🚀 How to Resolve This Issue
Update the Angular CLI to use the new default location
- Step 1: Run the following command to update the Angular CLI: `ng config set experimental-project-schemas true`
- Step 2: Then, run the following command to generate a new workspace file: `ng new my-app --workspace`
- Step 3: This will create a new directory called `ng` in the root of your project, where the workspace file will be stored.
Check if the Travis CI environment is configured correctly
- Step 1: Make sure that the `TRAVIS_WORKSPACE` environment variable is set to the correct location. This variable should point to the root directory of your project.
- Step 2: If this variable is not set, you can try setting it manually using the following command: `export TRAVIS_WORKSPACE=/home/travis/build/pradeep0601/Angular5-Router-App`
🎯 Final Words
By following these steps, you should be able to resolve the 'Local workspace file ('angular.json') could not be found' error and get your Angular project building successfully.
❓ Frequently Asked Questions
🛠️ Related Fixes
How to Fix: Stuck in tutorial hell after 4 years: How do I b
Fix Stuck in tutorial hell after 4 years: How do I bui. Practice build
How to Fix: Trying to sync mutliple audio tracks to a movie
Fix Trying to sync mutliple audio tracks to a movie bu. Consider using
How to Fix: Failed to merge latest branches from upstream re
Fix Failed to merge latest branches from upstream repo. Try running 'g