nx g @nrwl/nest:application changes `/` in project paths to `\\` in workspace.json
See original GitHub issueCurrent Behavior
When I generate a new NestJS application in my Nx workspace, \\
is now used where a /
was in the workspace.json file for project paths.
However this only applies to existing projects, the newly generated project does use /
.
Expected Behavior
The application generator does not change or mix /
and \\
usage.
Steps to Reproduce
create-nx-workspace --name test-project --preset empty --nx-cloud false
cd test-project
cat workspace.json
{
"version": 2,
"projects": {},
"cli": {
"defaultCollection": "@nrwl/workspace"
}
}
npm i -D @nrwl/nest
nx g @nrwl/nest:application api --standaloneConfig
Above command prints out an error but does succeed, see issue #6249, possibly relevant. However this behaviour still occurs even if I omit --standaloneConfig
from the second command (step 7) and the error does not happen then.
Failed to format: /angular.json
Error: 'project.json' files are incompatible with version 1 workspace schemas.
at C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\tao\src\shared\workspace.js:208:19
at Array.forEach (<anonymous>)
at toOldFormatOrNull (C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\tao\src\shared\workspace.js:206:37)
at Object.reformattedWorkspaceJsonOrNull (C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\tao\src\shared\workspace.js:167:53)
at updateWorkspaceJsonToMatchFormatVersion (C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\devkit\src\generators\format-files.js:59:41)
at Object.<anonymous> (C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\devkit\src\generators\format-files.js:21:9)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Jeroen\Projects\test-project\node_modules\tslib\tslib.js:114:62)
Failed to format: /angular.json
Error: 'project.json' files are incompatible with version 1 workspace schemas.
at C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\tao\src\shared\workspace.js:208:19
at Array.forEach (<anonymous>)
at toOldFormatOrNull (C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\tao\src\shared\workspace.js:206:37)
at Object.reformattedWorkspaceJsonOrNull (C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\tao\src\shared\workspace.js:167:53)
at updateWorkspaceJsonToMatchFormatVersion (C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\devkit\src\generators\format-files.js:59:41)
at Object.<anonymous> (C:\Users\Jeroen\Projects\test-project\node_modules\@nrwl\devkit\src\generators\format-files.js:21:9)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Jeroen\Projects\test-project\node_modules\tslib\tslib.js:114:62)
cat workspace.json
{
"version": 2,
"projects": {
"api": "apps/api"
},
"cli": {
"defaultCollection": "@nrwl/nest"
},
"defaultProject": "api"
}
nx g @nrwl/nest:application api2 --standaloneConfig
cat workspace.json
{
"version": 2,
"projects": {
"api": "apps\\api",
"api2": "apps/api2"
},
"cli": {
"defaultCollection": "@nrwl/nest"
},
"defaultProject": "api"
}
Failure Logs
None.
Environment
Node : 14.16.0
OS : win32 x64
npm : 6.14.13
nx : Not Found
@nrwl/angular : Not Found
@nrwl/cli : 12.5.8
@nrwl/cypress : Not Found
@nrwl/devkit : 12.5.8
@nrwl/eslint-plugin-nx : 12.5.8
@nrwl/express : Not Found
@nrwl/jest : 12.5.8
@nrwl/linter : 12.5.8
@nrwl/nest : 12.5.8
@nrwl/next : Not Found
@nrwl/node : 12.5.8
@nrwl/nx-cloud : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 12.5.8
@nrwl/web : Not Found
@nrwl/workspace : 12.5.8
@nrwl/storybook : Not Found
@nrwl/gatsby : Not Found
typescript : 4.2.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
workspace.json
Identified the locations of all project in the repo; Contained the target configuration for all projects. Identifying the locations of projects is now...
Read more >nrwl-nx/community - Gitter
Hello, I have a small issue with an nx-workspace and vscode. Whenever I do imports from libraries, vscode still offers me the relative...
Read more >Nrwl/Community #support #npm-packages #random
I'm working with builders in the workspace.json file. ... Similar to nx g @nrwl/react:component Login --project=project ?
Read more >angular this.tree.readtext is not a function
I was trying to make client side angular project to change it to SSR(Server Side Rendering) ... npm i -g create-nx-workspace npx create-nx-workspace...
Read more >Ng add @nrwl/workspace throws Cannot read property ...
\n' + 'If the error persists, please run "nx reset".' } Turn out there's missing line in file project.json generate by nx {...
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
Hey, I’ve been looking into this recently and have almost pinned it down. I could fix it easily by forcing the workspace path to be normalized, but it’s set on project.root currently. I want to figure out what’s causing that to be pulling in a windows path rather than fixing a symptom.
Sounds good. Thank you for the quick reply!