Adding @ngwl/workspace fails is config files are not in root
See original GitHub issueExpected Behavior
ng add @nrwl/workspace
should work to add Nx to existing Angular CLI project.
Current Behavior
If config files such as tsconfig.app.json
are stored in a subfolder such as src
, the add will fail.
Failure Information (for bugs)
The failure is happening because the ng-add schematic extracts the locations of the config files from angular.json, it runs them through a getFilename()
function that discards the rest of the path: https://github.com/nrwl/nx/blob/master/packages/workspace/src/schematics/ng-add/ng-add.ts#L381
Steps to Reproduce
ng new nx-test
cd nx-test
mv tsconfig.app.json src
- Edit
angular.json
and update the"tsConfig"
property of the project to the new path. ng add @nrwl/workspace
.
Context
Please provide any relevant information about your setup:
Nx: 8.1 Angular CLI: 8
Failure Logs
Renamed karma.conf.js -> apps/nx-test/karma.conf.js
Path: tsconfig.app.json does not exist
Renamed tsconfig.spec.json -> apps/nx-test/tsconfig.spec.json
Renamed src -> apps/nx-test/src
Renamed e2e -> apps/nx-test-e2e
ENOENT: no such file or directory, open 'apps/nx-test/tsconfig.app.json'
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Building CI/CD pipelines using dynamic config - CircleCI
In this post, I will walk you through how to implement dynamic configuration by creating a config file that is not in the...
Read more >salesforce/core ConfigAggregator resolving config file from ...
The problem is that no matter what I try, ConfigAggregator never returns local project configs. I have checked the github repo and found...
Read more >TypeScript TS6053: File ' .ts' not found - Stack Overflow
I got this "TS6053" error because Visual Studio 2017 didn't find a folder I added to a Angularjs project. The solution posted above...
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
systemPrefs with at least two files" status:RESOLVED resolution:OBSOLETE severity: ... Bug:126571 - "bug in kernel: amd64-agp fails to configure agp-bridge" ...
Read more >Angular workspace configuration
The angular.json file at the root level of an Angular workspace provides ... of the configuration file does not correspond exactly to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As a workaround, I needed to:
mv e2e/protractor.conf.js e2e/tsconfig.e2e.json src/tsconfig* src/karma.conf.js .
mv .prettierignore .prettierignore.bak
(as the schematic assumes this doesn’t exist)mv .prettierrc.json .prettierrc.json.bak
(ditto)The schematic also chokes if any of the target directories exist, which is a minor annoyance when repeatedly running the commands and then resetting the changes (which removes the files but not the directories).
In addition, a few other problems I encountered, for posterity and / or very keen maintainers:
extends
(pointed to../tslint.json
instead of../../../tslint.json
The workaround proposed by @studds is out of date for Angular 10. I’m trying to move files using exactly the same command
mv e2e/protractor.conf.js e2e/tsconfig.e2e.json src/tsconfig* src/karma.conf.js .
, but some file has different names.I won’t create an empty project to migrate the whole code from the previous repository to a new one. Some suggestion?