Command `nx run project:command` does not work if `command` contains a colon (`:`)
See original GitHub issueCurrent Behavior
When I try to run the command yarn nx run project:command
where the command has colon char in it, nx
returns an error as it is not be able to recognise it.
E.g.
I have a command in each package that is sub:cmd
.
I try to run that command for one package with yarn nx run package-a:"sub:cmd"
and it returns the error NX Cannot find target 'sub' for project 'package-a'
.
I tried with double quotes, with single quotes, and without, but I always receive the same error.
If I use the command format yarn nx sub:cmd package-a
it works.
Expected Behavior
Being able to execute a command in a package with colon in the command
Steps to Reproduce
You can use this link to reproduce the error. Head to the terminal and try to run yarn nx run package-a:"sub:cmd"
Failure Logs
Environment
Node : 14.18.1
OS : linux x64
yarn : 1.22.17
nx : 13.8.5
@nrwl/angular : undefined
@nrwl/cli : 13.8.5
@nrwl/cypress : undefined
@nrwl/detox : undefined
@nrwl/devkit : 13.8.5
@nrwl/eslint-plugin-nx : undefined
@nrwl/express : undefined
@nrwl/jest : 13.8.5
@nrwl/js : 13.8.5
@nrwl/linter : 13.8.5
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : undefined
@nrwl/tao : 13.8.5
@nrwl/web : undefined
@nrwl/workspace : 13.8.5
typescript : 4.5.5
rxjs : 6.6.7
---------------------------------------
Community plugins:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:6 (2 by maintainers)
Top Results From Across the Web
@nrwl/workspace:run-commands | Nx
We want a simple way to create empty bash script files for a given project, that have the execute permissions already set. Given...
Read more >Nx CLI run many command is not working for multiple apps
Try this: nx run-many --parallel --target=serve --projects=frontend,backend.
Read more >Executing Multi-Project Builds - Gradle User Manual
Executing tasks by name ... The command gradle test will execute the test task in any subprojects, relative to the current working directory,...
Read more >Cisco Nexus 9000 Series NX-OS Programmability Guide, Release ...
On Cisco Nexus switches, command-line interfaces (CLIs) are run only on the ... Config-replace will fail if the current running-config do not contain...
Read more >Terminal Shell Integration in Visual Studio Code
This standard, easy way will not work for some advanced use cases like in ... The Terminal: Run Recent Command command surfaces history...
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
I can confirm that wrapping with quotes works. In the terminal I had to escape the quotes with
\"
.That’s the method that
nx run
uses to parse the string (whichparse-target-string.ts
should be using but doesn’t).It should be a fairly easy PR. It would however impose more complexity on
splitTarget
, as it introduces an edge case (package-a:"sum:cmd
) which needs to be handled.Also docs 😅
EDIT: looking at lines 9-12 of the method I referenced above, it should already work 🤨
Relevant commit addressing this issue: https://github.com/nrwl/nx/commit/7d148598637cec5f19ae4963a3a146570efbd0b2